A service scheduling method, device and storage medium

By creating scheduling tasks and bindings for business entities on the scheduling system side and realizing message distribution, the problem that business modules need to pay attention to the underlying scheduling mechanism is solved, function reuse and resource conservation are realized, and rapid updates are supported.

CN111176799BActive Publication Date: 2024-11-12ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201811340426.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-11-12
Publication Date
2024-11-12
Estimated Expiration
2039-02-14

AI Technical Summary

Technical Problem

While performing business logic processing, existing business modules also need to pay attention to the underlying scheduling mechanism, resulting in waste of resources and increased implementation complexity.

Method used

By creating scheduling tasks for registered business entities on the scheduling system side, scanning the JOB registry to determine the attribution relationship, binding the scheduling tasks, and dispatching messages to the corresponding business entities through the scheduling tasks, realizing the logical processing of the message, and abstracting the business entities as messages Driven finite state machine, avoiding attention to the underlying scheduling mechanism.

Benefits of technology

Maximize function reuse, reduce implementation complexity, avoid resource waste, and support rapid updates of business entity versions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111176799B_ABST
    Figure CN111176799B_ABST
Patent Text Reader

Abstract

The present invention discloses a business scheduling method, device and storage medium. The method is executed on the scheduling system side, including: when starting the system, creating a scheduling task for a registered work entity JOB; receiving a message for sending to the JOB; and dispatching the message to the JOB through the scheduling task corresponding to the JOB. The method is executed on the business entity side, including: obtaining a JOB template; encapsulating the business logic of the business entity into a JOB according to the JOB template; registering the JOB; in the working state, if a message sent by the scheduling task corresponding to the JOB is received, performing logical processing on the message. The present invention abstracts the upper-level business entity into a message-driven JOB. After receiving the message, the JOB only needs to pay attention to the business logic and be responsible for executing the corresponding logical processing flow, without paying attention to the underlying scheduling mechanism, thereby avoiding resource waste.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a service scheduling method, device and storage medium. Background Art

[0002] Modern large-scale communication systems are composed of many business modules (business entities), for example, some business modules are responsible for call processing, some business modules are responsible for database operations, some business modules are responsible for version management, etc. The various business modules cooperate with each other to complete the functions of the entire communication system.

[0003] The traditional development model is that each business module independently implements a complete application architecture. For example, for any business module A, the business module A needs to independently implement the main processing function, create corresponding child threads according to actual needs, independently create sockets, and send and receive messages through the sockets to achieve interaction with other business modules. Each business module needs to independently implement such an application architecture, but the application of this application architecture requires that the business module, while executing business logic processing, also pay attention to the underlying scheduling operation and message interaction. If a problem is encountered, it can only be solved independently, which will undoubtedly cause a waste of resources.

[0004] In view of this problem, providing a universal scheduling communication method for various services to support unified scheduling of various services has become an issue to be solved urgently in this field. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a business scheduling method, device and storage medium to solve the problem that the existing business module not only needs to execute the business logic of the corresponding business, but also needs to pay attention to the underlying scheduling mechanism, which easily causes resource waste.

[0006] In order to solve the above technical problems, the present invention is solved by the following technical solutions:

[0007] The present invention provides a business scheduling method, which is executed on the scheduling system side, including: when starting the system, creating a scheduling task corresponding to a registered work entity JOB; wherein the JOB is obtained by encapsulating the business logic of the business entity according to a JOB template; receiving a message for sending to the JOB; and dispatching the message to the JOB through the scheduling task corresponding to the JOB so that the JOB performs logical processing on the message.

[0008] Among them, creating a scheduling task corresponding to the registered JOB includes: scanning the registration information of each JOB in the JOB registry; determining the JOB with the same affiliation according to the registration information of each JOB in the JOB registry; creating a scheduling task, and binding the scheduling task with the JOB with the same affiliation.

[0009] Among them, the message is dispatched to the JOB through the scheduling task corresponding to the JOB, including: after the message sending and receiving interface receives the message, query the JOB whose communication information is the same as the receiving information of the message; determine the scheduling task corresponding to the JOB; send the message to the scheduling task, and the scheduling task dispatches the message to the JOB.

[0010] Wherein, when the scheduling task corresponds to a JOB, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: sending the message to the socket of the scheduling task, and the scheduling task dispatches the message received by the socket to the JOB; wherein the socket is created by the scheduling task when it is initialized; when the scheduling task corresponds to multiple JOBs, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: sending the message to the socket of the scheduling task, and the scheduling task determines the JOB whose communication information is the same as the receiving information of the message based on the receiving information of the message and the communication information of each JOB in the multiple JOBs, and dispatches the message received by the socket to the JOB whose communication information is the same as the receiving information of the message.

[0011] Among them, the message is dispatched to the JOB through the scheduling task corresponding to the JOB, including: the scheduling task determines whether the JOB is waiting for a message according to the status of the JOB; if so, the context information of the scheduling task is saved, the context of the JOB is jumped to, and the message is dispatched to the JOB; if not, the message is cached in the task message queue of the scheduling task, and it is continued to be determined whether the JOB is waiting for a message; after the JOB completes the logical processing of the dispatched message, it jumps back to the context of the scheduling task according to the saved context information of the scheduling task.

[0012] Wherein, according to the state of the JOB, determining whether the JOB is waiting for a message includes: if the state of the JOB is a blocking state, determining that the JOB is waiting for a message; if the state of the JOB is a running state, determining that the JOB is processing a message; if the state of the JOB is a synchronous blocking state, determining that the JOB is waiting for a message; wherein, in the synchronous blocking state, the message that the JOB is waiting for is a response message corresponding to the synchronous message that the JOB has sent.

[0013] The method further includes: if the scheduling task corresponds to multiple JOBs, the scheduling task stores the message in a pending message queue corresponding to the other JOB after receiving a message sent by one of the multiple JOBs to another JOB, so that the other JOB obtains the message from the pending message queue.

[0014] The present invention also provides a business scheduling method, which is executed on the business entity side, including: obtaining a JOB template; encapsulating the business logic of the business entity into a JOB according to the JOB template; registering the JOB so that the scheduling system creates a scheduling task corresponding to the JOB; in a working state, if a message sent by the scheduling task corresponding to the JOB is received, performing logical processing on the message.

[0015] The present invention also provides a service scheduling device, which includes a processor and a memory; the processor is used to execute the service scheduling program stored in the memory to implement the service scheduling method executed on the scheduling system side as claimed in the claim, or to implement the service scheduling method executed on the business entity side as claimed in the claim.

[0016] The present invention further provides a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the business scheduling method executed on the scheduling system side as claimed in the claim, or to implement the business scheduling method executed on the business entity side as claimed in the claim.

[0017] The beneficial effects of an embodiment of the present invention are as follows:

[0018] The present invention abstracts the upper-level business entity into a message-driven finite state machine, which is the JOB (job entity). After receiving the message, the JOB only needs to focus on the business logic and be responsible for executing the corresponding logical processing flow without paying attention to the underlying scheduling mechanism. This can maximize functional reuse, reduce implementation complexity, avoid resource waste, and facilitate rapid updating of business entity versions. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flow chart of a service scheduling method executed on a scheduling system side according to a first embodiment of the present invention;

[0020] Figure 2 is a schematic diagram of the structure of a scheduling system according to a first embodiment of the present invention;

[0021] Figure 3 is a schematic diagram of the state transition of a JOB according to the first embodiment of the present invention;

[0022] Figure 4 is a flow chart of a service scheduling method executed on a service entity side according to a second embodiment of the present invention;

[0023] Figure 5 is a schematic diagram of two-level addressing according to a second embodiment of the present invention;

[0024] Figure 6 is a structural diagram of a service scheduling device according to a third embodiment of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0026] Embodiment 1

[0027] This embodiment provides a service scheduling method executed on the scheduling system side. Figure 1 FIG. 1 is a flow chart of a service scheduling method executed on a scheduling system side according to a first embodiment of the present invention.

[0028] Step S110: when the system is started, a scheduling task is created for the registered JOB.

[0029] JOB refers to a work entity, also known as a finite state machine. JOB is a business entity that encapsulates the business logic of the business entity according to the JOB template.

[0030] Scheduling tasks are used to dispatch messages received by the scheduling system to the recipient JOB of the message.

[0031] Specifically, since different business entities are responsible for different types of business, in order to distinguish different types of jobs (business entities) and accurately find a job in the scheduling system, the communication information of the job is unique. The communication information can be the communication address of the job.

[0032] When the scheduling system is started, it scans the registration information of each job in the job registry; determines the jobs with the same affiliation based on the registration information of each job in the job registry; creates a scheduling task, and binds the scheduling task to the job with the same affiliation.

[0033] The JOB registry is used for business entities to register encapsulated JOBs.

[0034] The essence of the job registry is an array, and each member in the array is a job. The information of each member includes but is not limited to: job name, stack size, priority of scheduled tasks, scheduled task index, and job entry function. The information of each member can also include job type, job instance, and job communication information.

[0035] Jobs with the same affiliation refer to multiple jobs that can be scheduled and managed by the same scheduling task. For example, the stack size, scheduling task priority, and scheduling task index of multiple jobs are the same.

[0036] The following is a code representation of a JOB registry:

[0037] T_ossJobCreatReg g_atJobRegTbl[]=

[0038] {

[0039] / *JobType Pri SchIndex Instance Name Entry StckSize DataSize Flags* /

[0040] {SVR_TYPE_TEST1,10,20,TEST1_JOB_INSTNUM,"tTestJob1",&Test1_Entry,8192,4096,TEST1_FUNBITS},

[0041] {SVR_TYPE_TEST2,10,15,TEST2_JOB_INSTNUM,"tTestJob2",&Test2_Entry,8192,4096,TEST2_FUNBITS},

[0042] };

[0043] Among them, JobType describes the JOB type, Pri describes the priority of the scheduling task, SchIndex describes the scheduling task index, Instance describes the JOB instance, Name describes the JOB name, Entry describes the JOB entry function, and StckSizeDataSize Flags describes the stack size.

[0044] When the scheduling system starts, it scans the job registry, completes resource application, and creates scheduling tasks for jobs with the same affiliation. After the scheduling task is initialized, the scheduling task sends a startup message to the corresponding job, driving each job to enter the working state and prepare to process messages.

[0045] Furthermore, if the affiliation relationship between a job and other jobs is different, the job is considered as a group of jobs with the same affiliation relationship, and a scheduling task is created for the job separately.

[0046] Furthermore, the scheduling task exists in the form of a thread. When the scheduling task is initialized, it creates a socket for sending and receiving information and applies for resources in the scheduling system. Under stable conditions, the scheduling task's socket receives the message sent by the scheduling system, and the scheduling task dispatches the message to the corresponding job, driving the job to perform logical processing on the message.

[0047] Step S120: receiving a message for sending to the JOB.

[0048] The scheduling system includes a message sending and receiving interface, which is the channel for the job to interact with the outside world. The scheduling system receives messages sent to the job from outside the scheduling system through the message sending and receiving interface, and can also send messages sent by the job to the outside of the scheduling system through the message sending and receiving interface.

[0049] In this embodiment, the message received by the message receiving and sending interface of the scheduling system includes a message header. The message header records the sending information and the receiving information. The sending message is the address information of the message sender. The receiving information is the address information of the message receiver.

[0050] Step S130: dispatch the message to the JOB through the scheduling task corresponding to the JOB, so that the JOB performs logical processing on the message.

[0051] After the message receiving and sending interface receives the message, it queries the job whose communication information is the same as the receiving information of the message; determines the scheduling task corresponding to the job; sends the message to the scheduling task, and the scheduling task dispatches the message to the job. Furthermore, based on the receiving information carried in the message and the communication information of each job, the job whose communication information is the same as the receiving information can be determined, and the job is the job to which the message needs to reach. Among them, the communication information of the job can be pre-registered in the job registration table, or actively sent to the scheduling system by the job.

[0052] In this embodiment, each scheduling task may correspond to one or more jobs. If a scheduling task corresponds to only one job, it is called primary scheduling; if a scheduling task corresponds to multiple jobs, it is called secondary scheduling.

[0053] When a scheduling task corresponds to a JOB, that is, when executing the first-level scheduling, the scheduling system sends a message to the socket of the scheduling task, and the scheduling task dispatches the message received by the socket to the JOB; wherein, the socket is created by the scheduling task when it is initialized.

[0054] When a scheduling task corresponds to multiple JOBs, that is, when executing secondary scheduling, the scheduling system sends a message to the socket of the scheduling task. The scheduling task determines the JOB whose communication information is the same as the message reception information based on the message reception information and the communication information of each JOB in the multiple JOBs, and dispatches the message received by the socket to the JOB whose communication information is the same as the message reception information.

[0055] For example: Figure 2 The figure is a schematic diagram of the structure of the scheduling system according to the first embodiment of the present invention. Scheduling task A corresponds to JOB1, JOB2 and JOB3. After scheduling task A receives the message from socket a, scheduling task A needs to perform secondary dispatch. First, it parses the message header to determine whether the recipient JOB of the message is JOB1, JOB2 or JOB3, and then saves the context information of the scheduling task, jumps to the context of the recipient JOB, and executes the message dispatch; after the recipient JOB message is processed, scheduling task A returns to the scheduling task context and waits to receive the next message. Scheduling task B corresponds to a JOB0. After scheduling task B receives the message from socket b, it dispatches the message to JOB0 to process the message. After the JOB0 message is processed, it returns to the scheduling task context and waits to receive the next message.

[0056] In this embodiment, before the scheduling task dispatches a message to the JOB, the scheduling task needs to determine whether the JOB is waiting for a message based on the status of the JOB; if so, the context information of the scheduling task is saved, the context of the JOB is jumped to, and the message is dispatched to the JOB; if not, the message is cached in the task message queue of the scheduling task, and the determination of whether the JOB is waiting for a message continues until it is determined that the JOB is waiting for a message, the message is obtained from the task message queue, the context information of the scheduling task is saved, the context of the JOB is jumped to, and the message is dispatched to the JOB; after the JOB completes the logical processing of the dispatched message, it jumps back to the context of the scheduling task based on the saved context information of the scheduling task.

[0057] Furthermore, the states of a JOB include: a blocking state, a running state, and a synchronous blocking state.

[0058] If the state of the JOB is a blocked state, it is determined that the JOB is waiting for a message;

[0059] If the state of the job is running, it is determined that the job is processing a message;

[0060] If the state of the JOB is a synchronous blocking state, it is determined that the JOB is waiting for a message; wherein, in the synchronous blocking state, the message that the JOB is waiting for is a response message corresponding to the synchronous message that the JOB has sent.

[0061] like Figure 3 As shown, it is a schematic diagram of the state transition of the JOB according to the first embodiment of the present invention. When the JOB obtains a message dispatched by a scheduling task or obtains resources in a blocking state, the state transitions to the running state; in the running state, if the JOB starts waiting for messages or resources, it transitions from the running state to the blocking state; of course, this embodiment mainly describes the scheduling process of messages, so the JOB can process messages in a blocking state, but cannot process messages temporarily in the running state. In some application scenarios that require data synchronization, the JOB is in a synchronous blocking state after sending a synchronization message. After receiving a response message or a synchronization timeout message corresponding to the synchronization message, the state transitions to the running state. After the response message or the synchronization timeout message is processed, the state transitions to the blocking state.

[0062] In this embodiment, if the scheduling task corresponds to multiple jobs, after receiving a message sent by one of the multiple jobs to another job, the scheduling task stores the message in the pending message queue corresponding to the other job, so that the other job can obtain the message from the pending message queue. Furthermore, the scheduling task can set a pending message queue for each corresponding job. When two secondary jobs under the same scheduling task communicate with each other, the scheduling task can cache the message in the pending message queue of the receiving job to avoid all messages being received from the socket and then dispatched to the receiving job. This method can effectively improve the performance of the scheduling system.

[0063] In this embodiment, if a job needs to send a message to the outside of the scheduling system, the message can be sent to the message transceiver interface of the scheduling system through the socket of the scheduling task corresponding to the job, and the message is sent out through the message transceiver interface. The message header includes receiving information and sending information. The receiving information is the address information of the receiver, and the sending information is the address information of the sender.

[0064] The business scheduling method of this embodiment can be used as a general scheduling communication framework, which abstracts the upper-level business entity into a message-driven finite state machine, namely, JOB (job entity). After receiving the message, JOB only needs to focus on the business logic and be responsible for executing the corresponding logical processing flow. It does not need to pay attention to the underlying scheduling mechanism, thereby maximizing functional reuse, reducing implementation complexity, avoiding resource waste, and facilitating the rapid update of business entity versions.

[0065] This embodiment encapsulates a set of universal message sending and receiving interfaces, delivers the message to a specific message receiver with the help of an addressing mechanism, completes message dispatching by a scheduling task, and drives the receiver's JOB to complete the logical processing of the message, thereby realizing a complete cycle of message generation, transmission, delivery, and consumption.

[0066] Embodiment 2

[0067] This embodiment provides a service scheduling method executed on the service entity side. Figure 4 FIG. 1 is a flow chart of a service scheduling method executed at a service entity side according to a second embodiment of the present invention.

[0068] Step S410, obtaining a JOB template.

[0069] The JOB template may be obtained from a preset JOB template server or a storage device of the scheduling system.

[0070] The JOB template can be used as a reference for business entities to implement the business logic of the business entity.

[0071] The JOB template is essentially a function, and the input parameters include but are not limited to: JOB status, message number, message body, and message byte order.

[0072] The following is a code representation of a JOB template:

[0073]

[0074] Among them, JobState describes the state of the JOB, MsgId describes the message number, MsgData describes the message body, and ByteOrder describes the message byte order.

[0075] Furthermore, the states of a JOB include: a blocking state, a running state, and a synchronous blocking state.

[0076] If the state of the JOB is a blocked state, it is determined that the JOB is waiting for a message;

[0077] If the state of the job is running, it is determined that the job is processing a message;

[0078] If the state of the JOB is a synchronous blocking state, it is determined that the JOB is waiting for a message; wherein, in the synchronous blocking state, the message that the JOB is waiting for is a response message corresponding to the synchronous message that the JOB has sent.

[0079] Step S420: encapsulate the business logic of the business entity into a JOB according to the JOB template.

[0080] A JOB is essentially a function that is driven by a message and performs corresponding logical processing. After being encapsulated according to the JOB template, the entry parameters of the JOB include but are not limited to: the JOB status, message number, message body, and message byte order.

[0081] Step S430, registering the JOB so that the scheduling system creates a scheduling task corresponding to the JOB.

[0082] After the business entity completes the business logic encapsulation by referring to the JOB template, the JOB implementation of the business entity can be obtained, and the JOB can be registered in the JOB registry, thereby integrating the JOB corresponding to the business entity into the scheduling system.

[0083] In the initial state, JOB receives the start message from the scheduling task, executes resource application, and enters the working state. In the working state, it is ready to process the message dispatched by the scheduling task. In the working state, each time a message is received, the corresponding logic processing is performed on the message.

[0084] The communication information of a job is unique and can be the communication address of the job.

[0085] In this embodiment, each JOB has a unique communication address, which is a prerequisite for the JOB to communicate. This embodiment provides a two-level addressing method to set a communication address for the JOB.

[0086] In this embodiment, the two-level addressing includes: process-level addressing and JOB-level addressing.

[0087] Process-level addressing: A globally unique communication address is configured for each process corresponding to a business entity (JOB), and the communication address of the process is called ComID. For easy identification, ComID is further segmented, and the communication address of the process is formed according to the service type (Service Type), service instance (Service Instance), module type (Unit Type), and module instance (UnitInstance) to which the process belongs. That is: ComID of the process = Service Type + Service Instance + Unit Type + Unit Instance.

[0088] Job level addressing: configure a job ID for each job. The job ID is JNO, which is unique within the process corresponding to the job (business entity). JNO consists of a job type and a job instance, i.e., JNO = job type + job instance. This can support multiple job instances formed by multiple copies of the same process or the same thread.

[0089] Based on ComID and JNO, the globally unique JOB communication address can be obtained, that is: JOB communication address = JNO + ComID, and this communication address can point to the unique JOB in the scheduling system.

[0090] For example: Figure 5 The figure shows a schematic diagram of two-level addressing according to the second embodiment of the present invention. JOB1 and JOB2 under scheduling task A correspond to process X, the communication address of process X is ComID1, the JNO of JOB1 is JNO1, and the JNO of JOB2 is JNO2; JOB3 under scheduling task B corresponds to process Y, the communication address of process Y is ComID2, and the JNO of JOB3 is JNO3; then, it can be obtained that: the communication address of JOB1 = JNO1 + ComID1, the communication address of JOB2 = JNO2 + ComID1; the communication address of JOB3 = JNO3 + ComID2.

[0091] The secondary addressing process can be executed on the business entity side. After the secondary addressing, the JOB can send its communication address to the scheduling system, or it can register the communication address as registration information in the JOB registration table when registering the JOB.

[0092] Step S440: In the working state, if a message sent by the scheduling task corresponding to the JOB is received, logical processing is performed on the message.

[0093] The JOB executes the corresponding processing logic for each message received and transitions the state of the JOB.

[0094] If the structure of the received message is different from the message structure that this job can process, the received message is first formatted and then logically processed. For example, for a message sent from a heterogeneous CPU (Central Processing Unit) node, the job performs byte order conversion on the message before processing it.

[0095] The business entity of this embodiment only needs to encapsulate the business logic in the form of a JOB according to the JOB template and register it in the JOB registry. The subsequent operation of the JOB is entirely the responsibility of the scheduling task, which greatly reduces the implementation complexity.

[0096] This embodiment uses a unified dispatching communication framework, so that upper-level business entities can focus on the implementation of business logic without worrying about how the underlying system operates or how message interaction is implemented. This embodiment greatly shortens the development time of business entities, improves the reuse rate of code, and provides a guarantee for the rapid launch of new versions of various business applications.

[0097] Embodiment 3

[0098] This embodiment provides a service scheduling device. Figure 6 FIG. 4 is a structural diagram of a service scheduling device according to a third embodiment of the present invention.

[0099] In this embodiment, the service scheduling device includes but is not limited to: a processor 610 and a memory 620. The processor 610 is used to execute the service scheduling program stored in the memory 620 to implement the service scheduling method executed on the scheduling system side as claimed in the claims, or to implement the service scheduling method executed on the service entity side as claimed in the claims.

[0100] Specifically, the processor 610 is used to execute the business scheduling program stored in the memory 620 to implement the following steps of the business scheduling method performed on the scheduling system side: when starting the system, create a scheduling task corresponding to the registered work entity JOB; wherein the JOB is obtained by encapsulating the business logic of the business entity according to the JOB template; receive a message to be sent to the JOB; and dispatch the message to the JOB through the scheduling task corresponding to the JOB so that the JOB performs logical processing on the message.

[0101] Among them, creating a scheduling task corresponding to the registered JOB includes: scanning the registration information of each JOB in the JOB registry; determining the JOB with the same affiliation according to the registration information of each JOB in the JOB registry; creating a scheduling task, and binding the scheduling task with the JOB with the same affiliation.

[0102] Among them, the message is dispatched to the JOB through the scheduling task corresponding to the JOB, including: after the message sending and receiving interface receives the message, query the JOB whose communication information is the same as the receiving information of the message; determine the scheduling task corresponding to the JOB; send the message to the scheduling task, and the scheduling task dispatches the message to the JOB.

[0103] Wherein, when the scheduling task corresponds to a JOB, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: sending the message to the socket of the scheduling task, and the scheduling task dispatches the message received by the socket to the JOB; wherein the socket is created by the scheduling task when it is initialized; when the scheduling task corresponds to multiple JOBs, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: sending the message to the socket of the scheduling task, and the scheduling task determines the JOB whose communication information is the same as the receiving information of the message based on the receiving information of the message and the communication information of each JOB in the multiple JOBs, and dispatches the message received by the socket to the JOB whose communication information is the same as the receiving information of the message.

[0104] Among them, the message is dispatched to the JOB through the scheduling task corresponding to the JOB, including: the scheduling task determines whether the JOB is waiting for a message according to the status of the JOB; if so, the context information of the scheduling task is saved, the context of the JOB is jumped to, and the message is dispatched to the JOB; if not, the message is cached in the task message queue of the scheduling task, and it is continued to be determined whether the JOB is waiting for a message; after the JOB completes the logical processing of the dispatched message, it jumps back to the context of the scheduling task according to the saved context information of the scheduling task.

[0105] Wherein, according to the state of the JOB, determining whether the JOB is waiting for a message includes: if the state of the JOB is a blocking state, determining that the JOB is waiting for a message; if the state of the JOB is a running state, determining that the JOB is processing a message; if the state of the JOB is a synchronous blocking state, determining that the JOB is waiting for a message; wherein, in the synchronous blocking state, the message that the JOB is waiting for is a response message corresponding to the synchronous message that the JOB has sent.

[0106] The method further includes: if the scheduling task corresponds to multiple JOBs, the scheduling task stores the message in a pending message queue corresponding to the other JOB after receiving a message sent by one of the multiple JOBs to another JOB, so that the other JOB obtains the message from the pending message queue.

[0107] Specifically, the processor 610 is used to execute the business scheduling program stored in the memory 620 to implement the following steps of the business scheduling method performed on the business entity side: obtain a JOB template; encapsulate the business logic of the business entity into a JOB according to the JOB template; register the JOB so that the scheduling system creates a scheduling task corresponding to the JOB; in a working state, if a message sent by the scheduling task corresponding to the JOB is received, perform logical processing on the message.

[0108] Embodiment 4

[0109] The embodiment of the present invention also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0110] When one or more programs in the storage medium can be executed by one or more processors, the service scheduling method executed on the scheduling system side or the service scheduling method executed on the service entity side can be implemented.

[0111] The processor is used to execute the business scheduling program stored in the memory to implement the following steps of the business scheduling method executed on the scheduling system side: when starting the system, create a scheduling task corresponding to the registered work entity JOB; wherein the JOB is obtained by encapsulating the business logic of the business entity according to the JOB template; receive a message to be sent to the JOB; and dispatch the message to the JOB through the scheduling task corresponding to the JOB so that the JOB performs logical processing on the message.

[0112] Among them, creating a scheduling task corresponding to the registered JOB includes: scanning the registration information of each JOB in the JOB registry; determining the JOB with the same affiliation according to the registration information of each JOB in the JOB registry; creating a scheduling task, and binding the scheduling task with the JOB with the same affiliation.

[0113] Among them, the message is dispatched to the JOB through the scheduling task corresponding to the JOB, including: after the message sending and receiving interface receives the message, query the JOB whose communication information is the same as the receiving information of the message; determine the scheduling task corresponding to the JOB; send the message to the scheduling task, and the scheduling task dispatches the message to the JOB.

[0114] Wherein, when the scheduling task corresponds to a JOB, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: sending the message to the socket of the scheduling task, and the scheduling task dispatches the message received by the socket to the JOB; wherein the socket is created by the scheduling task when it is initialized; when the scheduling task corresponds to multiple JOBs, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: sending the message to the socket of the scheduling task, and the scheduling task determines the JOB whose communication information is the same as the receiving information of the message based on the receiving information of the message and the communication information of each JOB in the multiple JOBs, and dispatches the message received by the socket to the JOB whose communication information is the same as the receiving information of the message.

[0115] Among them, the message is dispatched to the JOB through the scheduling task corresponding to the JOB, including: the scheduling task determines whether the JOB is waiting for a message according to the status of the JOB; if so, the context information of the scheduling task is saved, the context of the JOB is jumped to, and the message is dispatched to the JOB; if not, the message is cached in the task message queue of the scheduling task, and it is continued to be determined whether the JOB is waiting for a message; after the JOB completes the logical processing of the dispatched message, it jumps back to the context of the scheduling task according to the saved context information of the scheduling task.

[0116] Wherein, according to the state of the JOB, determining whether the JOB is waiting for a message includes: if the state of the JOB is a blocking state, determining that the JOB is waiting for a message; if the state of the JOB is a running state, determining that the JOB is processing a message; if the state of the JOB is a synchronous blocking state, determining that the JOB is waiting for a message; wherein, in the synchronous blocking state, the message that the JOB is waiting for is a response message corresponding to the synchronous message that the JOB has sent.

[0117] The method further includes: if the scheduling task corresponds to multiple JOBs, the scheduling task stores the message in a pending message queue corresponding to the other JOB after receiving a message sent by one of the multiple JOBs to another JOB, so that the other JOB obtains the message from the pending message queue.

[0118] The processor is used to execute the business scheduling program stored in the memory to implement the following steps of the business scheduling method performed on the business entity side: obtaining a JOB template; encapsulating the business logic of the business entity into a JOB according to the JOB template; registering the JOB so that the scheduling system creates a scheduling task corresponding to the JOB; in a working state, if a message sent by the scheduling task corresponding to the JOB is received, performing logical processing on the message.

[0119] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0120] Although the preferred embodiments of the present invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that various modifications, additions and substitutions are possible, and thus, the scope of the present invention should not be limited to the above embodiments.

Claims

1. A service scheduling method, characterized in that: Executed on the scheduling system side, including: When the system is started, a scheduling task is created for the registered job entity JOB; wherein the JOB is obtained by encapsulating the business logic of the business entity according to the JOB template; Receive a message for sending to the JOB; The message is dispatched to the JOB through the scheduling task corresponding to the JOB, so that the JOB performs logical processing on the message. The scheduling task corresponds to one or more JOBs. When the scheduling task corresponds to multiple JOBs, and multiple JOBs with the same affiliation correspond to the same scheduling task, secondary scheduling is performed. The JOBs with the same affiliation refer to multiple JOBs that can be scheduled and managed through the same scheduling task.

2. The method according to claim 1, characterized in that: The creation of a scheduling task for a registered JOB includes: Scan the registration information of each job in the job registry; According to the registration information of each job in the job registration table, determine the jobs with the same affiliation; A scheduling task is created, and the scheduling task is bound to the job with the same affiliation.

3. The method according to claim 1, characterized in that The message is dispatched to the job through the scheduling task corresponding to the job, including: After the message receiving and sending interface receives the message, query the JOB whose communication information is the same as the receiving information of the message; Determine the scheduling task corresponding to the JOB; The message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB.

4. The method according to claim 3, characterized in that When the scheduling task corresponds to a JOB, the message is sent to the scheduling task, and the scheduling task dispatches the message to the JOB, including: The message is sent to the socket of the scheduling task, and the scheduling task dispatches the message received by the socket to the JOB; wherein the socket is created by the scheduling task when it is initialized; When the scheduling task corresponds to multiple jobs, the message is sent to the scheduling task, and the scheduling task dispatches the message to the job, including: The message is sent to the socket of the scheduling task, and the scheduling task determines the JOB whose communication information is the same as the receiving information of the message based on the receiving information of the message and the communication information of each JOB in the multiple JOBs, and dispatches the message received by the socket to the JOB whose communication information is the same as the receiving information of the message.

5. The method according to claim 1, characterized in that The message is dispatched to the job through the scheduling task corresponding to the job, including: Enable the scheduling task to determine whether the JOB is waiting for a message according to the state of the JOB; If yes, save the context information of the scheduled task, jump to the context of the JOB, and dispatch the message to the JOB; If not, the message is cached in the task message queue of the scheduled task, and further determination is made as to whether the JOB is waiting for a message; After the JOB completes the logical processing of the dispatched message, it jumps back to the context of the scheduled task according to the saved context information of the scheduled task.

6. The method according to claim 5, characterized in that Determining whether the job is waiting for a message according to the state of the job includes: If the state of the JOB is a blocked state, it is determined that the JOB is waiting for a message; If the state of the job is running, it is determined that the job is processing a message; If the state of the JOB is a synchronous blocking state, it is determined that the JOB is waiting for a message; Among them, in the synchronous blocking state, the message that the JOB is waiting for is the response message corresponding to the synchronous message that the JOB has sent.

7. The method according to claim 1, characterized in that The method further comprises: If the scheduling task corresponds to multiple JOBs, after receiving a message sent by one of the multiple JOBs to another JOB, the scheduling task stores the message in the pending message queue corresponding to the other JOB, so that the other JOB obtains the message from the pending message queue.

8. A service scheduling method, characterized in that: Executed on the business entity side, including: Get the JOB template; According to the JOB template, encapsulate the business logic of the business entity into a JOB; Register the job so that the scheduling system can create a scheduling task corresponding to the job; In the working state, if a message sent by a scheduling task corresponding to the JOB is received, logical processing is performed on the message. The scheduling task corresponds to one or more JOBs. When the scheduling task corresponds to multiple JOBs, and multiple JOBs with the same affiliation correspond to the same scheduling task, secondary scheduling is performed. The JOBs with the same affiliation refer to multiple JOBs that can be scheduled and managed through the same scheduling task.

9. A service scheduling device, characterized in that: The service scheduling device includes a processor and a memory; the processor is used to execute the service scheduling program stored in the memory to implement the service scheduling method described in any one of claims 1 to 7, or to implement the service scheduling method described in claim 8.

10. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the service scheduling method described in any one of claims 1 to 7, or to implement the service scheduling method described in claim 8.