CN112559158A - Micro-service timing task scheduling method and device - Google Patents

Micro-service timing task scheduling method and device Download PDF

Info

Publication number
CN112559158A
CN112559158A CN202011594523.5A CN202011594523A CN112559158A CN 112559158 A CN112559158 A CN 112559158A CN 202011594523 A CN202011594523 A CN 202011594523A CN 112559158 A CN112559158 A CN 112559158A
Authority
CN
China
Prior art keywords
task
micro
calling
service
timing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011594523.5A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
National Clearing Center People's Bank Of China
Original Assignee
National Clearing Center People's Bank Of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by National Clearing Center People's Bank Of China filed Critical National Clearing Center People's Bank Of China
Priority to CN202011594523.5A priority Critical patent/CN112559158A/en
Publication of CN112559158A publication Critical patent/CN112559158A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic

Abstract

The embodiment of the application provides a method and a device for scheduling micro-service timing tasks, wherein the method comprises the following steps: determining a timing task to be executed by the target micro service according to a timing task table, and initializing the timing task; when the system time of the target micro service reaches the trigger time of the timing task, executing calling operation on at least one other micro service according to a preset batch processing task attribute table corresponding to the timing task; the method and the device can automatically and flexibly realize the timing calling operation among the plurality of microservices.

Description

Micro-service timing task scheduling method and device
Technical Field
The application relates to the field of micro services, in particular to a micro service timing task scheduling method and device.
Background
In the prior art, when a Timer provided by a JDK and a schedule execution service newly added to the JDK1.5 are used to implement a timing task, only a simple timing task execution logic can be implemented, for example, the timing task is executed once every several seconds, and the timing task cannot be flexibly added, deleted, or modified, when the micro-service is triggered by the timing task, when there are multiple classes in one micro-service, each class needs to provide an independent interface for other micro-services to call, and when different classes of methods of multiple micro-services are called in one micro-service at the same time, a service call logic relationship becomes complex and is difficult to maintain.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides a method and a device for scheduling a micro-service timing task, which can automatically and flexibly realize the timing calling operation among a plurality of micro-services.
In order to solve at least one of the above problems, the present application provides the following technical solutions:
in a first aspect, the present application provides a method for scheduling a micro-service timed task, including:
determining a timing task to be executed by the target micro service according to a timing task table, and initializing the timing task;
and when the system time of the target micro service reaches the trigger time of the timing task, executing calling operation on at least one other micro service according to a preset batch processing task attribute table corresponding to the timing task.
Further, the executing a call operation on at least one other microservice according to a preset batch processing task attribute table corresponding to the timing task includes:
determining calling interface information, calling method information, calling parameters and calling micro-service information corresponding to the timing task according to the preset batch processing task attribute table;
generating a micro-service calling instruction according to the calling interface information, the calling method information, the calling parameter and the calling micro-service information;
and executing calling operation on the other corresponding micro services according to the micro service calling instruction.
Further, still include:
after the timing task is initialized, adding a task incomplete label for the timing task;
adding a task completed label for the timing task after the execution of the calling operation of all other micro services in the timing task is completed;
and when the system time of the target micro service reaches the trigger time of another timing task, executing calling operation on other micro services in the timing task added with the task incomplete label according to a preset batch processing task attribute table.
Further, still include:
and receiving a batch processing task attribute editing instruction of a user, and updating the batch processing task attribute table according to the batch processing task attribute editing instruction.
In a second aspect, the present application provides a micro-service timed task scheduling device, including:
the timing task initialization module is used for determining a timing task to be executed by the target micro service according to the timing task table and initializing the timing task;
and the micro-service timing calling module is used for executing calling operation on at least one other micro-service according to a preset batch processing task attribute table corresponding to the timing task when the system time of the target micro-service reaches the trigger time of the timing task.
Further, the microservice timing calling module comprises:
the batch processing task attribute determining unit is used for determining calling interface information, calling method information, calling parameters and calling micro-service information corresponding to the timing task according to the preset batch processing task attribute table;
the micro-service calling instruction generating unit is used for generating a micro-service calling instruction according to the calling interface information, the calling method information, the calling parameter and the calling micro-service information;
and the micro-service calling execution unit is used for executing calling operation on the corresponding other micro-services according to the micro-service calling instruction.
Further, still include:
a task incomplete label adding unit, configured to initialize the timing task and then add a task incomplete label to the timing task;
the task completed label adding unit is used for adding a task completed label for the timing task after the execution of the calling operation of all other micro services in the timing task is completed;
and the uncompleted task re-execution unit is used for executing calling operation on other micro services in the timed task added with the task uncompleted label according to a preset batch processing task attribute table when the system time of the target micro service reaches the trigger time of another timed task.
Further, still include:
and the batch processing task attribute table self-defining editing unit is used for receiving a batch processing task attribute editing instruction of a user and updating the batch processing task attribute table according to the batch processing task attribute editing instruction.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the micro-service timing task scheduling method when executing the program.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for scheduling microservice timed tasks.
According to the technical scheme, the method and the device for scheduling the micro-service timed task are characterized in that the timed task to be executed by the target micro-service is determined according to the timed task list, the timed task is initialized, and when the system time of the target micro-service reaches the trigger time of the timed task, the calling operation is executed on at least one other micro-service according to the preset batch task attribute list corresponding to the timed task, so that the target micro-service can be flexibly and uniformly called on other micro-services through the preset batch task attribute list.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart illustrating a method for scheduling a micro-service timed task according to an embodiment of the present application;
FIG. 2 is a second flowchart illustrating a method for scheduling a micro-service timed task according to an embodiment of the present application;
fig. 3 is a third schematic flowchart of a method for scheduling a micro-service timed task in an embodiment of the present application;
FIG. 4 is a block diagram of a microservice timed task scheduler in an embodiment of the present application;
FIG. 5 is a second block diagram of a microservice timed task scheduler in an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In consideration of the problems of complex service calling logic relation and difficult maintenance in the prior art, the application provides a micro-service timed task scheduling method and device, the timed task to be executed by a target micro-service is determined according to a timed task table, the timed task is initialized, and when the system time of the target micro-service reaches the trigger time of the timed task, the scheduling operation is executed on at least one other micro-service according to a preset batch processing task attribute table corresponding to the timed task, so that the target micro-service can be flexibly and uniformly called on other micro-services through the preset batch processing task attribute table.
In order to automatically and flexibly implement a timing call operation among a plurality of micro services, the present application provides an embodiment of a micro service timing task scheduling method, and referring to fig. 1, the micro service timing task scheduling method specifically includes the following contents:
step S101: and determining a timing task to be executed by the target micro service according to the timing task table, and initializing the timing task.
Optionally, in another possible embodiment of the present application, the present application may further set a scheduled timed task table, and the scheduled timed task table is used to enable or disable some timed tasks according to scheduled requirements, and set a timed task trigger time; the other timing tasks on the current day which are started in the scheduled timing task table are generated through the initialization tasks on the day in the timing task table, and meanwhile, the initialization timing tasks on the next day are generated.
Optionally, the timing task table of the present application records information of a timing task to be executed within a current date of the system, after the initialization timing task is executed, the timing task table generates a timing task to be executed on the current date and an initialization timing task of a next date according to a scheduled timing task table, a completion state of a timing task just generated is initially "incomplete", after the system triggers the timing task on the current date, the completion state is changed to "completed" or "stopped", after the initialization timing task of the next date, a timing task trigger time in the timing task table is also synchronously updated to a next system date time, the state is "incomplete", and the timing task table waits for the execution of the timing trigger, that is, the timing task table records only relevant information such as the timing task state of the current date of the system.
Optionally, the system state in the timed task table also corresponds to the batch system state in the batch task attribute table.
Step S102: and when the system time of the target micro service reaches the trigger time of the timing task, executing calling operation on at least one other micro service according to a preset batch processing task attribute table corresponding to the timing task.
Optionally, the present application is configured to implement that a target microservice calls a plurality of other microservices, which are mainly obtained by reflecting through a preset batch processing task attribute table, where the batch processing task attribute table records information of other microservices to be called by a batch scheduling microservice, such as microservice name, interface name, method name, call type, call parameter, and the like, where the interface is a public interface and mainly functions to implement calling between different microservices, and in addition, the batch processing task attribute table also records a corresponding relationship between a system state and batch processing, a completion state of a batch processing task, and the like.
Specifically, the method and the device can dynamically assign the attribute values microserviceName and schema id of the @ RpcReference annotation, namely define an interface object called between the microservices in a batch call microservice (such as a batch task attribute table), set all the attribute values of the @ RpcReference annotation of the object to be null, and then assign the attribute microserviceName and the schema id of the interface to the microserviceName and the interface name acquired in the batch task attribute table through an agent invokandler to realize the call of different microservices.
On the other hand, the batch processing task attribute table can flexibly configure batch processing tasks to be called and record the completion states of all batch processing on the current system date, and if optional batch processing on the current system date is not completed, the optional batch processing can be manually called again in the subsequent system state. Meanwhile, the timing task table can trigger system state change through the timing task, and the batch scheduling service calls all batch tasks in the current system state after the system state is changed, so that automatic calling of the batch tasks is realized, and synchronous calling and asynchronous calling can be realized according to different calling modes.
As can be seen from the above description, the method for scheduling a micro-service timed task provided in the embodiment of the present application can determine a timed task to be executed by a target micro-service according to a timed task table, initialize the timed task, and execute a call operation on at least one other micro-service according to a preset batch task attribute table corresponding to the timed task when the system time of the target micro-service reaches the trigger time of the timed task, thereby implementing flexible and unified call of the target micro-service to other micro-services through the preset batch task attribute table.
In order to flexibly and accurately implement the call operation on a plurality of other micro services through a unified interface, in an embodiment of the micro service timing task scheduling method of the present application, referring to fig. 2, the following may be further specifically included:
step S201: and determining calling interface information, calling method information, calling parameters and calling micro-service information corresponding to the timing task according to the preset batch processing task attribute table.
Step S202: and generating a micro-service calling instruction according to the calling interface information, the calling method information, the calling parameter and the calling micro-service information.
Step S203: and executing calling operation on the other corresponding micro services according to the micro service calling instruction.
Optionally, the batch processing task attribute table in the present application records information of other micro services that need to be called by the batch scheduling micro service, such as a micro service name, an interface name, a method name, a calling type, a calling parameter, and the like, where the interface is a common interface and mainly functions to realize calling between different micro services, and in addition, the batch processing task attribute table also records a corresponding relationship between a system state and batch processing, a completion state of a batch processing task, and the like.
Optionally, the method and the device for calling the micro-service may generate a micro-service calling instruction through the calling interface information, the calling method information, the calling parameter and the calling micro-service information, and perform a calling operation on the corresponding other micro-service according to the micro-service calling instruction.
In order to ensure the success rate of the micro service invoking operation, in an embodiment of the micro service timing task scheduling method of the present application, referring to fig. 3, the following may be further included:
step S301: and adding a task incomplete label for the timing task after initializing the timing task.
Step S302: and adding a task completed label for the timing task after the execution of the calling operation of all other micro services in the timing task is completed.
Step S303: and when the system time of the target micro service reaches the trigger time of another timing task, executing calling operation on other micro services in the timing task added with the task incomplete label according to a preset batch processing task attribute table.
Optionally, the timing task table of the present application records information of a timing task to be executed within a current date of the system, after the initialization timing task is executed, the timing task table generates a timing task to be executed on the current date and an initialization timing task of a next date according to a scheduled timing task table, a completion state of a timing task just generated is initially "incomplete", after the system triggers the timing task on the current date, the completion state is changed to "completed" or "stopped", after the initialization timing task of the next date, a timing task trigger time in the timing task table is also synchronously updated to a next system date time, the state is "incomplete", and the timing task table waits for the execution of the timing trigger, that is, the timing task table records only relevant information such as the timing task state of the current date of the system.
Meanwhile, the batch processing task attribute table can flexibly configure batch processing tasks to be called and record the completion states of all batch processing on the current system date, and if optional batch processing on the current system date is not completed, the optional batch processing can be manually called again in the subsequent system state. For example, if the timing task fails to execute or is not executed due to expiration of other reasons, the timing task execution time can be manually updated to trigger again after the reasons are found and the problem is solved.
Meanwhile, the timing task table can trigger system state change through the timing task, and the batch scheduling service calls all batch tasks in the current system state after the system state is changed, so that automatic calling of the batch tasks is realized, and synchronous calling and asynchronous calling can be realized according to different calling modes.
In order to improve flexibility of the invoking operation on a plurality of other micro services, in an embodiment of the micro service timing task scheduling method of the present application, the following may be specifically included:
and receiving a batch processing task attribute editing instruction of a user, and updating the batch processing task attribute table according to the batch processing task attribute editing instruction.
Optionally, the batch processing task attribute editing instruction may perform custom dynamic modification on an attribute value of the @ RpcReference annotation in the program, and the program may also acquire batch processing task information from the batch processing task attribute table and dynamically assign a value to the attribute of the @ RpcReference annotation, so that the program does not need to be modified when a micro-service or interface call relationship is added to the batch processing task attribute table.
In order to automatically and flexibly implement a timing call operation among a plurality of micro services, the present application provides an embodiment of a micro service timed task scheduling apparatus for implementing all or part of the contents of the micro service timed task scheduling method, and referring to fig. 4, the micro service timed task scheduling apparatus specifically includes the following contents:
and the timing task initialization module 10 is configured to determine a timing task to be executed by the target micro service according to the timing task table, and initialize the timing task.
And the micro-service timing calling module 20 is configured to, when the system time of the target micro-service reaches the trigger time of the timing task, perform a calling operation on at least one other micro-service according to a preset batch task attribute table corresponding to the timing task.
As can be seen from the above description, the device for scheduling a timed task of a micro service provided in the embodiment of the present application can determine a timed task to be executed by a target micro service according to a timed task table, initialize the timed task, and execute a call operation on at least one other micro service according to a preset batch task attribute table corresponding to the timed task when the system time of the target micro service reaches the trigger time of the timed task, thereby implementing flexible and unified call of the target micro service to other micro services through the preset batch task attribute table.
In order to flexibly and accurately implement the invoking operation of a plurality of other micro services through a unified interface, in an embodiment of the micro service timed task scheduling apparatus of the present application, referring to fig. 5, the micro service timed invoking module 20 includes:
and the batch processing task attribute determining unit 21 is configured to determine, according to the preset batch processing task attribute table, call interface information, call method information, call parameters, and call micro-service information corresponding to the timing task.
And a micro-service call instruction generating unit 22, configured to generate a micro-service call instruction according to the call interface information, the call method information, the call parameter, and the call micro-service information.
And the micro-service calling execution unit 23 is configured to execute a calling operation on the corresponding other micro-service according to the micro-service calling instruction.
In order to ensure the success rate of the micro service invoking operation, in an embodiment of the micro service timing task scheduling apparatus of the present application, the following contents are further specifically included:
and the task incomplete label adding unit is used for adding a task incomplete label for the timing task after initializing the timing task.
And the task completed label adding unit is used for adding a task completed label for the timing task after the execution of the calling operation of all other micro services in the timing task is completed.
And the uncompleted task re-execution unit is used for executing calling operation on other micro services in the timed task added with the task uncompleted label according to a preset batch processing task attribute table when the system time of the target micro service reaches the trigger time of another timed task.
Specifically, the batch processing task attribute table can flexibly configure batch processing tasks to be called and record the completion states of all batch processing on the current system date, and if optional batch processing on the current system date is not completed, the optional batch processing can be manually called again in the subsequent system state. For example, if the timing task fails to execute or is not executed due to expiration of other reasons, the timing task execution time can be manually updated to trigger again after the reasons are found and the problem is solved.
In order to improve flexibility of the invoking operation of multiple other micro services, in an embodiment of the micro service timed task scheduling apparatus of the present application, the following contents are further specifically included:
and the batch processing task attribute table self-defining editing unit is used for receiving a batch processing task attribute editing instruction of a user and updating the batch processing task attribute table according to the batch processing task attribute editing instruction.
In terms of hardware, in order to automatically and flexibly implement a timing call operation between multiple microservices, the present application provides an embodiment of an electronic device for implementing all or part of the contents in the microservice timing task scheduling method, where the electronic device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between the micro-service timing task scheduling device and relevant equipment such as a core service system, a user terminal, a relevant database and the like; the logic controller may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the logic controller may refer to the embodiment of the method for scheduling a micro-service timed task and the embodiment of the device for scheduling a micro-service timed task in the embodiments for implementation, and the contents thereof are incorporated herein, and repeated details are not repeated.
It is understood that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a Personal Digital Assistant (PDA), an in-vehicle device, a smart wearable device, and the like. Wherein, intelligence wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In practical applications, part of the micro-service timed task scheduling method may be executed on the electronic device side as described above, or all operations may be completed in the client device. The selection may be specifically performed according to the processing capability of the client device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. The client device may further include a processor if all operations are performed in the client device.
The client device may have a communication module (i.e., a communication unit), and may be communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, the server may also include a server on an intermediate platform, for example, a server on a third-party server platform that is communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed apparatus.
Fig. 6 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 6, the electronic device 9600 can include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this FIG. 6 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In one embodiment, the micro-service timed task scheduling method function may be integrated into the central processor 9100. The central processor 9100 may be configured to control as follows:
step S101: and determining a timing task to be executed by the target micro service according to the timing task table, and initializing the timing task.
Step S102: and when the system time of the target micro service reaches the trigger time of the timing task, executing calling operation on at least one other micro service according to a preset batch processing task attribute table corresponding to the timing task.
As can be seen from the above description, in the electronic device provided in the embodiment of the present application, the timing task to be executed by the target micro service is determined according to the timing task table, and the timing task is initialized, and when the system time of the target micro service reaches the trigger time of the timing task, a call operation is performed on at least one other micro service according to the preset batch task attribute table corresponding to the timing task, so that flexible and unified call of the target micro service to the other micro services is achieved through the preset batch task attribute table.
In another embodiment, the micro-service timed task scheduling device may be configured separately from the central processing unit 9100, for example, the micro-service timed task scheduling device may be configured as a chip connected to the central processing unit 9100, and the micro-service timed task scheduling method function is realized by the control of the central processing unit.
As shown in fig. 6, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 also does not necessarily include all of the components shown in fig. 6; further, the electronic device 9600 may further include components not shown in fig. 6, which may be referred to in the art.
As shown in fig. 6, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. Memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
An embodiment of the present application further provides a computer-readable storage medium capable of implementing all the steps in the method for scheduling a micro-service timed task with a server or a client as an execution subject in the foregoing embodiments, where the computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, the computer program implements all the steps in the method for scheduling a micro-service timed task with a server or a client as an execution subject in the foregoing embodiments, for example, when the processor executes the computer program, the processor implements the following steps:
step S101: and determining a timing task to be executed by the target micro service according to the timing task table, and initializing the timing task.
Step S102: and when the system time of the target micro service reaches the trigger time of the timing task, executing calling operation on at least one other micro service according to a preset batch processing task attribute table corresponding to the timing task.
As can be seen from the above description, in the computer-readable storage medium provided in this embodiment of the present application, a timing task to be executed by a target microservice is determined according to a timing task table, and the timing task is initialized, and when a system time of the target microservice reaches a trigger time of the timing task, a call operation is performed on at least one other microservice according to a preset batch task attribute table corresponding to the timing task, so that flexible and unified call of the target microservice to other microservices is achieved through the preset batch task attribute table.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for scheduling micro-service timed tasks, the method comprising:
determining a timing task to be executed by the target micro service according to a timing task table, and initializing the timing task;
and when the system time of the target micro service reaches the trigger time of the timing task, executing calling operation on at least one other micro service according to a preset batch processing task attribute table corresponding to the timing task.
2. The method for scheduling the micro-service timed task according to claim 1, wherein the executing a call operation on at least one other micro-service according to a preset batch task attribute table corresponding to the timed task comprises:
determining calling interface information, calling method information, calling parameters and calling micro-service information corresponding to the timing task according to the preset batch processing task attribute table;
generating a micro-service calling instruction according to the calling interface information, the calling method information, the calling parameter and the calling micro-service information;
and executing calling operation on the other corresponding micro services according to the micro service calling instruction.
3. The method for scheduling microservice timed tasks according to claim 1, further comprising:
after the timing task is initialized, adding a task incomplete label for the timing task;
adding a task completed label for the timing task after the execution of the calling operation of all other micro services in the timing task is completed;
and when the system time of the target micro service reaches the trigger time of another timing task, executing calling operation on other micro services in the timing task added with the task incomplete label according to a preset batch processing task attribute table.
4. The method for scheduling microservice timed tasks according to claim 1, further comprising:
and receiving a batch processing task attribute editing instruction of a user, and updating the batch processing task attribute table according to the batch processing task attribute editing instruction.
5. A microservice timed task scheduler comprising:
the timing task initialization module is used for determining a timing task to be executed by the target micro service according to the timing task table and initializing the timing task;
and the micro-service timing calling module is used for executing calling operation on at least one other micro-service according to a preset batch processing task attribute table corresponding to the timing task when the system time of the target micro-service reaches the trigger time of the timing task.
6. The microservice timed task scheduler according to claim 5, wherein the microservice timed call module comprises:
the batch processing task attribute determining unit is used for determining calling interface information, calling method information, calling parameters and calling micro-service information corresponding to the timing task according to the preset batch processing task attribute table;
the micro-service calling instruction generating unit is used for generating a micro-service calling instruction according to the calling interface information, the calling method information, the calling parameter and the calling micro-service information;
and the micro-service calling execution unit is used for executing calling operation on the corresponding other micro-services according to the micro-service calling instruction.
7. The microservice timed task scheduler according to claim 5, further comprising:
a task incomplete label adding unit, configured to initialize the timing task and then add a task incomplete label to the timing task;
the task completed label adding unit is used for adding a task completed label for the timing task after the execution of the calling operation of all other micro services in the timing task is completed;
and the uncompleted task re-execution unit is used for executing calling operation on other micro services in the timed task added with the task uncompleted label according to a preset batch processing task attribute table when the system time of the target micro service reaches the trigger time of another timed task.
8. The microservice timed task scheduler according to claim 5, further comprising:
and the batch processing task attribute table self-defining editing unit is used for receiving a batch processing task attribute editing instruction of a user and updating the batch processing task attribute table according to the batch processing task attribute editing instruction.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of microserver timed task scheduling according to any of claims 1 to 4 are implemented when the program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the microserver timed task scheduling method according to any one of claims 1 to 4.
CN202011594523.5A 2020-12-29 2020-12-29 Micro-service timing task scheduling method and device Pending CN112559158A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011594523.5A CN112559158A (en) 2020-12-29 2020-12-29 Micro-service timing task scheduling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011594523.5A CN112559158A (en) 2020-12-29 2020-12-29 Micro-service timing task scheduling method and device

Publications (1)

Publication Number Publication Date
CN112559158A true CN112559158A (en) 2021-03-26

Family

ID=75032810

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011594523.5A Pending CN112559158A (en) 2020-12-29 2020-12-29 Micro-service timing task scheduling method and device

Country Status (1)

Country Link
CN (1) CN112559158A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113592471A (en) * 2021-07-29 2021-11-02 中国人民银行清算总中心 Payment transaction application system and method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113592471A (en) * 2021-07-29 2021-11-02 中国人民银行清算总中心 Payment transaction application system and method

Similar Documents

Publication Publication Date Title
CN111786885B (en) Distributed full-link gray level routing method and device
CN111031058A (en) Websocket-based distributed server cluster interaction method and device
CN111813601B (en) Micro-service rollback method and device for stateful distributed cluster
CN111679790A (en) Remote software development storage space distribution method and device
CN111679811B (en) Web service construction method and device
CN111445331A (en) Transaction matching method and device
CN111367561B (en) Remote development method and device for software program
CN113342330A (en) Front-end engineering generation method and device
CN112559158A (en) Micro-service timing task scheduling method and device
CN112689012A (en) Cross-network proxy communication method and device
CN112953908A (en) Network isolation configuration method, device and system
CN110427260B (en) Host job scheduling method, device and system
CN115562898A (en) Distributed payment system exception handling method and device
CN111930624B (en) Test link message data processing method and device
CN113050985A (en) Front-end engineering dependence automatic registration method and device
CN113434423A (en) Interface test method and device
CN111953847A (en) Client message risk reminding method, device and system
CN114637587A (en) Task batch processing method and device under cluster architecture deployment
CN113342501B (en) System fault processing method and device
CN114090489B (en) IO expansion method and device based on virtio
CN115827771A (en) Cross-platform data heterogeneous scheduling method and device
CN113050937A (en) Front-end data processing method and device based on command line
CN115936652A (en) To-do work data processing method and device
CN115563137A (en) Stationary point data processing method and device
CN111737299A (en) Cache data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination