Timed task management system
1. A timed task management system, comprising: the system comprises a page configuration module, a task production module, a message module and a task consumption module;
the page configuration module is used for configuring different timing task strategies based on configuration information of a user and writing the timing task strategies into a strategy table;
the task production module is used for monitoring the implementation of the policy table and generating a corresponding task plan based on the timing task policy;
the message module is used for delaying pushing of the task plan so as to ensure the performance of task execution;
and the task consumption module is used for routing the task plan to the corresponding processing module to execute the timing task.
2. The timed task management system according to claim 1, characterized in that the configuration information of said user comprises: and (5) adding, modifying, deleting and starting and stopping the timing task.
3. The timed task management system according to claim 1, wherein the task production module is further configured to write the corresponding task plan into the message module and set the execution frequency as the message expiration time when the number of the task plans in the task table is less than 3.
4. The timed task management system according to claim 3, wherein said task production module is further configured to not generate a new timed task plan for the current strategy when the number of the task plans in the task table is not less than 3.
5. The timed task management system according to claim 3, wherein the message module is further configured to send a corresponding expired message to the mortgage switch after the task plan expires, and the mortgage switch is configured to forward the expired message to the corresponding message queue for consumption by the consumer.
Background
At present, in various development projects, various data need to be accessed, data sources are different, a data measurement model is quite large, different data acquisition, processing and other operations need to be carried out on different data, each data is processed through different timing tasks, the timing tasks are required to be added, deleted, modified at any time and take effect immediately, restarting operation is not needed, configuration modification of the timing task data sources, the execution frequency and the like is supported, and configuration management can be carried out on the timing tasks to a certain extent.
In the existing technical scheme, a timing task is added, deleted and modified by applying a hard code, and a project needs to be recompiled and deployed. Different execution frequencies need to be written, or a universal type processing module cannot be used, different execution frequencies are used, tasks of the same type are executed at the same frequency, the defects of code reusability are caused, the content of the timed tasks needs to be written by hard codes, the tasks can be effective only by recompiling, deploying and restarting the applications, and the configuration is not flexible, time-consuming and labor-consuming.
Disclosure of Invention
In order to solve the problems of insufficient configuration, time and labor consumption and complex operation in the prior art, the invention provides a timed task management system which has the characteristics of more flexible configuration, more time and labor saving and the like.
A timed task management system according to an embodiment of the present invention includes: the system comprises a page configuration module, a task production module, a message module and a task consumption module;
the page configuration module is used for configuring different timing task strategies based on configuration information of a user and writing the timing task strategies into a strategy table;
the task production module is used for monitoring the implementation of the policy table and generating a corresponding task plan based on the timing task policy;
the message module is used for delaying pushing of the task plan so as to ensure the performance of task execution;
and the task consumption module is used for routing the task plan to the corresponding processing module to execute the timing task.
Further, the configuration information of the user includes: and (5) adding, modifying, deleting and starting and stopping the timing task.
Further, the task production module is further configured to, when the number of the task plans in the task table is less than 3, write the corresponding task plan into the message module and set the execution frequency as the message expiration time.
Further, the task production module is further configured to not generate a new timing task plan for the current policy when the number of the task plans in the task table is not less than 3.
Further, the message module is further configured to send a corresponding expired message to a deceased switch after the task plan expires, and the deceased switch is configured to forward the expired message to a corresponding message queue for consumption by a consumer.
The invention has the beneficial effects that: different timing task strategies are configured through a page configuration module based on configuration information of a user, and the timing task strategies are written into a strategy table, so that the user only needs to be concerned about a service layer for configuration, does not need to be concerned about implementation of a bottom layer code, and has good user experience; the task production module monitors implementation of the strategy table, generates a corresponding task plan based on a timing task strategy, and detaches the correlation between the service logic and the code logic of the timing task to realize that the configuration is effective; the delayed pushing of the task plan of the message module is used for ensuring the performance of task execution, supporting a large number of timing tasks with different periods and supporting the timing tasks to a second level; and the task consumption module is used for routing the task plan to the corresponding processing module to execute the timing task. The configuration of the timing task management is more flexible, the time is saved, and the timing task execution of various types of multi-task in any period is realized under the highly flexible timing task management.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of a timed task management system provided in accordance with an exemplary embodiment.
1-a page configuration module; 2-a task production module; 3-a message module; 4-task consumption module.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Referring to fig. 1, an embodiment of the present invention provides a timing task management system, which specifically includes:
the system comprises a page configuration module 1, a task production module 2, a message module 3 and a task consumption module 4;
the page configuration module 1 is used for configuring different timing task strategies based on the configuration information of the user and writing the timing task strategies into a strategy table; the method has the advantages that a series of management such as addition, modification, deletion, start and stop of the timing task is carried out through the page, so that the threshold of the user for the management of the timing task is greatly reduced, the user only needs to care about the configuration of a service layer, the realization of a bottom code is not needed, and good user experience is achieved;
the task production module 2 is used for monitoring implementation of the strategy table and generating a corresponding task plan based on the timing task strategy; monitoring the configured task strategy, generating a corresponding task plan in real time, stripping the association between the service logic and the code logic of the timing task, realizing that the configuration is effective and paying more attention to the task generation without paying more attention to the service rule and the processing module;
the message module 3 is used for delayed pushing of the task plan to ensure the performance of task execution; by utilizing the timeliness of the consumption queue of the rabbitMQ, the delay queue is realized, the production requirements are perfectly matched under the scene of the current timing task, a large number of timing tasks with different periods are supported, and the timing task is supported to the second level.
The task consumption module 4 is used for routing the task plan to the corresponding processing module to execute the timing task. The execution of the timing task is completed by monitoring the task plan and routing the task plan to the processing modules of different types.
The timing task manager is designed and realized, ingenious timing execution design is utilized, the scene requirements of the existing complex production are met, the timing task configuration management is highly flexible, various operations on the tasks are supported, and the timing task manager can take effect immediately, a user does not need to pay attention to the realization logic of codes, only needs to pay attention to the service configuration, takes effect immediately for the user, does not need any other operation, and the timing task execution of various types of multiple tasks in any period is realized under the highly flexible timing task management.
As a feasible implementation manner of the above embodiment, the user configures different timing task policies through the page configuration module, and the system writes the timing task policies into the policy table; the task production module can acquire the strategy of the strategy table in real time every second, and generates a corresponding timing task plan and writes the timing task plan into the task table by judging whether the current strategy has less than 3 corresponding task plans in the task table or not, and simultaneously writes the task plan into a delay queue of a rabbitMQ and sets the execution frequency as the message expiration time; if not, the current strategy does not generate a new timing task plan. When the task plan message of the delay queue is over, the delay queue can send the message to the deceased switch, the deceased switch can forward the overdue message to the corresponding message module for consumption of consumers, each type has corresponding delay queue and consumption queue, and the performance of task execution is ensured; the task consumption module consumes the messages (timing task plan) of the queue, routes the messages to the corresponding type processing module, executes the processing and writes the execution result back to the task table.
The rabbitMQ comprises a delay Queue, a dead-end switch and a consumption Queue, the MQ is called a Message Queue, and a Message Queue (MQ) is a communication method of an application program to the application program. Applications communicate by reading and writing messages (data for the application) to and from the queue without requiring a dedicated connection to link them. Message passing refers to the communication between programs by sending data in a message, rather than communicating with each other through direct calls, which are often used for techniques such as remote procedure calls. Queuing refers to the application communicating through a queue. The use of queues removes the requirement that the receiving and sending applications execute simultaneously. And the rabbitMQ is an open source message queue system developed by Erlang language and is realized based on an AMQP protocol. The main features of AMQP are message oriented, queue, routing (including point-to-point and publish/subscribe), reliability, security. The AMQP protocol is more used in enterprise systems, and has high requirements on data consistency, stability and reliability, and the requirements on performance and throughput are further.
The timing task management system provided by the embodiment of the invention can be used for highly flexible timing task configuration management, including task addition, modification, deletion, start and stop and the like, and can be in effect immediately; modifying and supporting the timing task content, the execution frequency and the like, and taking effect immediately; the execution frequency of the timing task is accurate to the second level, and any period is supported; the timing task flow is designed asynchronously, and business logic and code logic are stripped; the high-abstraction processing module is compatible with multi-task processing; and different types of task addition are supported, so that the ingenious design realization of a timing task scene is realized.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
What has been described above includes examples of one or more embodiments. It is, of course, not possible to describe every conceivable combination of components or methodologies for purposes of describing the aforementioned embodiments, but one of ordinary skill in the art may recognize that many further combinations and permutations of various embodiments are possible. Accordingly, the embodiments described herein are intended to embrace all such alterations, modifications and variations that fall within the scope of the appended claims. Furthermore, to the extent that the term "includes" is used in either the detailed description or the claims, such term is intended to be inclusive in a manner similar to the term "comprising" as "comprising" is interpreted when employed as a transitional word in a claim. Furthermore, any use of the term "or" in the specification of the claims is intended to mean a "non-exclusive or".
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种可视化服务编排方法及装置