Quartz-based batch master control automatic scheduling method, device and storage medium

Through the batch total control automatic scheduling method based on quartz, the problems of inefficiency and low resource utilization of traditional task scheduling methods in complex business systems are solved, efficient, reliable and flexible scheduling of tasks are achieved, and the overall system is improved Performance and reliability.

CN118796399BActive Publication Date: 2024-11-19CHENGDU TIENON TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411263251.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-11-19
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

Traditional task scheduling methods have problems such as inefficiency, low resource utilization, chaotic task execution, lack of effective recovery mechanisms and difficulty in achieving balanced task allocation in complex business systems, especially in distributed system environments.

Method used

Using the automatic scheduling method of batch total control based on quartz, the batch task information maintenance table and batch control table are preconfigured, and tasks are allocated and managed using quartz distributed scheduling-load balancing, dynamically assembled task data and passed the Method class Reflection calls to execute tasks to realize centralized management of tasks and resource optimization.

Benefits of technology

It improves the efficiency and reliability of task scheduling, realizes centralized management of a large number of tasks and efficient utilization of resources, reduces management costs and complexity, and enhances the scalability and flexibility of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796399B_ABST
    Figure CN118796399B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and in particular to a batch master control automatic scheduling method, device and storage medium based on quartz. The present invention can fully utilize the resources of the system and improve the overall performance and reliability of the system. Batch task information is pre-set on the master control end, batch task information is obtained and batch control information is initialized by initializing platform timing or transaction initiation triggering, platform timing triggering is executed, information to be executed is obtained from the batch control table, and then the batch task is called to pass parameters through the quartz distributed scheduling-load balancing method, the parameters are passed to a server end of the cluster, the batch task processing data is called to be dynamically assembled, and stored in the task data mapping, the server-side batch task execution process calls the corresponding method through the reflection of the Method class, and then the batch control table is updated, and the above process is repeated until the batch processing cannot be performed.
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 batch master control automatic scheduling method, device and storage medium based on Quartz. Background Art

[0002] Traditional task scheduling methods have many limitations and shortcomings. For example, using simple timing tools or scripts to schedule tasks often lacks the ability to centrally manage and monitor tasks. This may lead to confusion and conflicts in task execution, as well as the inability to promptly discover and handle errors during task execution.

[0003] In some complex business systems, there may be a large number of tasks of different types, priorities, and execution cycles. If manual or simple scheduling methods are used, it is not only inefficient, but also difficult to ensure that tasks are accurately executed according to predetermined rules. In addition, traditional scheduling methods often lack effective recovery and rescheduling mechanisms when facing system failures, restarts, or resource shortages, which can easily lead to task delays or losses.

[0004] In a distributed system environment, traditional scheduling methods are also difficult to achieve balanced task allocation and collaborative work, and cannot fully utilize system resources, affecting the overall performance and reliability of the system.

[0005] It is in this context that the batch master control automatic scheduling mode based on Quartz came into being, aiming to solve the various problems faced by the above-mentioned traditional scheduling methods and provide an efficient, reliable, flexible and easy-to-manage task scheduling solution for complex business systems. Summary of the invention

[0006] The purpose of the present invention is to provide a batch master control automatic scheduling method based on Quartz, which provides an efficient, reliable, flexible and easy-to-manage task scheduling mode for complex business systems.

[0007] On the one hand, the batch master control automatic scheduling method based on Quartz includes the following steps:

[0008] The batch master control automatic scheduling method based on Quartz is characterized by comprising the following steps:

[0009] S1. The master control end pre-configures the batch task information maintenance table, and the platform timing trigger or transaction initiation trigger is assembled with the batch task information maintenance table into a batch control table;

[0010] S2. When the platform is triggered on a scheduled basis, the batch control table is found and the information to be executed is obtained from the batch control table. The information to be executed includes the class of the task and the specific execution method. The name of the specific execution method is task execution method + [step];

[0011] S3. The master control end calls the batch task to pass the task class and specific execution method in the information to be executed, and passes the task class and specific execution method to different servers in the cluster through Quartz distributed scheduling-load balancing;

[0012] S4. The server side dynamically assembles the class of the task passed and the specific execution method, and then stores them in the task data mapping on the server side. Then, the batch processing task on the server side is called to call the corresponding class and method in the task data mapping through reflection of the Method class. After the method is executed, the batch status in the batch control table is updated, and S2-S4 are repeated until batch processing cannot be performed.

[0013] Furthermore, the data items of the batch task information maintenance table are:

[0014] Business category;

[0015] Business serial number;

[0016] The class of the task;

[0017] Task execution method;

[0018] Batch processing steps sequence;

[0019] Whether to schedule the task: 0-No 1-Yes;

[0020] The time of the timing trigger;

[0021] Cycle type: 1-year 2-season 3-month 4-week 5-day 6-hour 7-minute 8-second;

[0022] Interval period;

[0023] Last batch run time;

[0024] The data items in the batch control table include:

[0025] Batch number;

[0026] Business category;

[0027] Business serial number;

[0028] The class of the task;

[0029] Task execution method prefix;

[0030] Batch status;

[0031] Batch processing steps;

[0032] The current processing step;

[0033] Number of executions;

[0034] Other information;

[0035] The data items of the batch task information maintenance table are divided into three categories, including business information, task information, and time information;

[0036] Business information includes business category and business serial number;

[0037] Task information includes task class, task execution method, and batch processing steps;

[0038] Time information includes whether it is a scheduled task, the time of the scheduled trigger, the cycle type, the interval cycle, and the last batch run time;

[0039] The master control end obtains the business information and task information from the batch task information maintenance table, and registers the business information and task information in the batch control table;

[0040] The batch number in the batch control table is generated according to the business category in the business information. The first step of the batch processing step in the task information is assigned to the current processing step as the initial value. The batch status has a default value of "0-unprocessed" and the execution count has a default value of 0.

[0041] Furthermore, the batch status in the batch control table includes: 0-unprocessed; 1-processing, 2-step completed, 3-step failed, 4-batch invalidated, 5-whole batch completed, 9-whole batch failed; when the batch status is 4-batch invalidated, 5-whole batch completed, 9-whole batch failed, the batch processing will no longer continue.

[0042] Furthermore, through the processing method of Quartz to batch process tasks, the parameters are dynamically assembled according to the batch information as follows:

[0043] The data is stored in an array in the task data mapping, and the elements in the array include the batch business processing class corresponding to the business category, the task execution method and the current step.

[0044] Furthermore, the batch status flow is divided into step execution method status and method execution result:

[0045] Step execution method status:

[0046] Start the execution status of the unexecuted step from "0" to "1";

[0047] If a step fails, the failed step execution status will be re-initiated and changed from "3" to "1";

[0048] If a step fails continuously and the number of executions of the step is greater than or equal to 10 times, the entire batch fails and the status changes from "3" to "9".

[0049] Method execution results:

[0050] When the method is executed successfully, the method execution result status changes from "1" to "2";

[0051] When the method execution fails, the method execution result status changes from "1" to "3";

[0052] There are no subsequent steps, and the method execution result status changes from "2" to "5";

[0053] When the manual work is invalid, the method execution result status changes from "Other" to "4".

[0054] Furthermore, a computer device includes:

[0055] A memory for storing instructions;

[0056] The processor is used to execute the instructions so as to realize the batch master control automatic scheduling method based on Quartz.

[0057] Furthermore, a computer-readable storage medium stores a computer program, which, when executed, can implement a batch master control automatic scheduling method based on Quartz.

[0058] The present invention has the beneficial effects:

[0059] 1.By using the batch information maintenance table, the business information of different businesses is stored in it, which enables centralized management of a large number of tasks, reduces management costs and complexity, facilitates maintenance, and enhances the scalability and flexibility of the system, making it easy to add, modify and delete business information.

[0060] 2.Batch tasks are allocated through Quartz distributed scheduling-load balancing, which realizes the refined management of batch tasks and improves resource utilization and task execution effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a schematic diagram of the process of the present invention.

[0062] Figure 2 Maintains graph for batch task information.

[0063] Figure 3 It is a batch task control chart.

[0064] Figure 4 This is the state flow diagram of batch information. DETAILED DESCRIPTION

[0065] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0066] Example 1

[0067] See also Figures 1 to 4 ,

[0068] The batch master control automatic scheduling method based on Quartz includes the following steps:

[0069] S1. The master control end pre-configures the batch task information maintenance table, and the platform timing trigger or transaction initiation trigger is assembled with the batch task information maintenance table into a batch control table;

[0070] S2. When the platform is triggered on a scheduled basis, the batch control table is found and the information to be executed is obtained from the batch control table. The information to be executed includes the class of the task and the specific execution method. The name of the specific execution method is task execution method + [step];

[0071] S3. The master control end calls the batch task to pass the task class and specific execution method in the information to be executed, and passes the task class and specific execution method to the server end in the cluster through the Quartz distributed scheduling-load balancing method;

[0072] S4. The server side dynamically assembles the class of the task passed and the specific execution method, and then stores them in the task data mapping on the server side. The batch processing task on the server side is called through the reflection of the Method class to call the corresponding class and method in the task data mapping. After the method is executed, the batch status is updated to the batch control table. Repeat S2-S4 until batch processing cannot be performed.

[0073] The corresponding classes and methods in the reflection call task data mapping of the Method class are as follows:

[0074] For example, 1: Task data mapping content [job_bean: classA, job_method: A_deal0], calling the A_deal0 method of classA;

[0075] For example, 2: Task data mapping content [job_bean: classA, job_method: A_deal1], calling the A_deal1 method of classA;

[0076] For example, 3: Task data mapping content [job_bean: classB, job_method: B_deal1], calling the B_deal1 method of classB;

[0077] Furthermore, the data items of the batch task information maintenance table are:

[0078] Business category;

[0079] Business serial number;

[0080] The class of the task;

[0081] Task execution method;

[0082] Batch processing step sequence;

[0083] Whether to schedule the task: 0-No 1-Yes;

[0084] The time of the timing trigger;

[0085] Cycle type: 1-year 2-season 3-month 4-week 5-day 6-hour 7-minute 8-second;

[0086] Interval period;

[0087] Last batch run time;

[0088] The data items in the batch control table include:

[0089] Batch number;

[0090] Business category;

[0091] Business serial number;

[0092] The class of the task;

[0093] Task execution method prefix;

[0094] Batch status;

[0095] Batch processing steps;

[0096] The current processing step;

[0097] Number of executions;

[0098] Additional information.

[0099] The data items of the batch task information maintenance table are divided into three categories, including business information, task information, and time information.

[0100] Business information includes business category and business serial number;

[0101] Task information includes task class, task execution method, and batch processing steps;

[0102] Time information includes whether it is a scheduled task, the time of the scheduled trigger, the cycle type, the interval cycle, and the last batch run time.

[0103] The master control end obtains the business information and task information from the batch task information maintenance table, and registers the business information and task information in the batch control table.

[0104] The batch number in the batch control table is generated according to the business category in the business information. The first step of the batch processing step in the task information is assigned to the current processing step as the initial value. The batch status has a default value of "0-unprocessed" and the execution count has a default value of 0.

[0105] The batch control table is composed of the platform timing trigger or transaction initiation trigger and the batch task information maintenance table.

[0106] The platform obtains the class and actual execution method of the task in the corresponding batch control table through timed triggering of the master control end, calls the batch processing task to pass the class and actual execution method of the task as parameters to the server for processing, and calls the actual execution method under the class of the corresponding task through reflection of the Method class; then updates the batch control table, and the class and actual execution method of the task in the batch control table can be obtained without the platform being triggered by timed triggering, and repeats the above steps until batch processing cannot be performed.

[0107] Furthermore, the batch status in the batch control table includes: 0-unprocessed; 1-processing, 2-step completed, 3-step failed, 4-batch invalidated, 5-whole batch completed, 9-whole batch failed; when the batch status is 4-batch invalidated, 5-whole batch completed, 9-whole batch failed, the batch processing will no longer continue.

[0108] Furthermore, through the processing method of Quartz to batch process tasks, the parameters are dynamically assembled according to the batch information as follows:

[0109] The data is stored in an array in the task data mapping, and the elements in the array contain the corresponding business categories, task execution methods and current steps in sequence.

[0110] For example:

[0111] The class of the task is classA, the method of the task is A_deal, the current step is "0", and the task data mapping is stored in: [job_bean: classA, job_method: A_deal0]

[0112] The class of the task is classB, the method of the task is B_deal, the current step is "1", and the task data mapping is stored in: [job_bean: classB, job_method: B_deal1]

[0113] Furthermore, the batch status flow is as follows:

[0114] Start the execution status of the unexecuted step from "0" to "1";

[0115] If a step fails, the failed step execution status will be re-initiated and changed from "3" to "1";

[0116] If a step fails continuously and the number of executions of the step is greater than or equal to 10 times, the entire batch fails and the status changes from "3" to "9".

[0117] When the method is executed successfully, the method execution result status changes from "1" to "2";

[0118] When the method execution fails, the method execution result status changes from "1" to "3";

[0119] There are no subsequent steps, and the method execution result status changes from "2" to "5";

[0120] When the manual work is invalid, the method execution result status changes from "Other" to "4".

[0121] Furthermore, a computer device includes:

[0122] A memory for storing instructions;

[0123] The processor is used to execute the instructions so as to realize the batch master control automatic scheduling method based on Quartz.

[0124] Furthermore, a computer-readable storage medium stores a computer program, which, when executed, can implement a batch master control automatic scheduling method based on Quartz.

[0125] It is understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. The batch master control automatic scheduling method based on Quartz is characterized by: The following steps are involved: S1. The master control end pre-configures the batch task information maintenance table, assembles the platform timing trigger or transaction initiation trigger and the batch task information maintenance table into a batch control table, and divides the data items of the batch task information maintenance table into three categories, including business information, task information, and time information; The master control end obtains the business information and task information from the batch task information maintenance table, and registers the business information and task information in the batch control table; The batch number in the batch control table is generated according to the business category in the business information. The first step of the batch processing step in the task information is assigned to the current processing step as the initial value. The batch status has a default value of "0-unprocessed" and the execution count has a default value of 0. S2. When the platform is triggered on a scheduled basis, the batch control table is found and the information to be executed is obtained from the batch control table. The information to be executed includes the class of the task and the specific execution method. The name of the specific execution method is task execution method + [step]; S3. The master control end calls the batch task to pass the task class and specific execution method in the information to be executed, and passes the task class and specific execution method to different servers in the cluster through Quartz distributed scheduling-load balancing; S4. The server stores the class of the task and the specific execution method into the task data mapping on the server side, and then calls the batch processing task on the server side for dynamic assembly, and stores the data in the array in the task data mapping. The elements in the array contain the classes and task execution method prefixes corresponding to the business categories and the current processing steps. The corresponding classes and methods in the task data mapping are called through reflection of the Method class. After the method is executed, the batch status is updated in the batch control table, and S2-S4 are repeated until batch processing cannot be performed.

2. The batch master control automatic scheduling method based on Quartz according to claim 1 is characterized in that: The data items of the batch task information maintenance table are: Business category; Business serial number; The class of the task; Task execution method. The actual execution method name is the specific execution method, corresponding to the method name of the specific batch processing step; Batch processing step sequence; Whether to schedule the task: 0-No 1-Yes; The time of the timing trigger; Cycle type: 1-year 2-season 3-month 4-week 5-day 6-hour 7-minute 8-second; Interval period; Last batch run time; The data items in the batch control table include: Batch number; Business category; Business serial number; The class of the task; Task execution method; Batch processing steps; The current processing step; Batch status; Number of executions; Other information; Business information includes business category and business serial number; Task information includes task class, task execution method, and batch processing steps; Time information includes whether it is a scheduled task, the time of the scheduled trigger, the cycle type, the interval cycle, and the last batch run time.

3. The batch master control automatic scheduling method based on Quartz according to claim 2 is characterized in that: The batch status in the batch control table includes: 0-unprocessed; 1-processing, 2-step completed, 3-step failed, 4-batch invalidated, 5-batch completed, 9-batch failed; When the batch status is 4-batch invalidated, 5-batch completed, or 9-batch failed, the batch processing will not continue.

4. The batch master control automatic scheduling method based on Quartz according to claim 3 is characterized in that: The batch status flow is as follows: Start the unexecuted step execution status from "0" to "1"; If a step fails, the failed step execution status will be re-initiated and changed from "3" to "1"; If a step fails continuously and the number of executions of the step is greater than or equal to 10 times, the entire batch fails and the status changes from "3" to "9"; When the method is executed successfully, the method execution result status changes from "1" to "2"; When the method execution fails, the method execution result status changes from "1" to "3"; There are no subsequent steps, and the method execution result status changes from "2" to "5"; When this method step is interrupted manually, the method execution result status changes from "other" to "4".

5. A computer device, characterized in that: include A memory for storing instructions; A processor is used to execute the instructions so as to implement any one of the quartz-based batch master control automatic scheduling methods as claimed in claims 1 to 4.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, it can implement any one of the quartz-based batch master control automatic scheduling methods as claimed in claims 1 to 4.