CN109144683A - Task processing method, device, system and electronic equipment - Google Patents
Task processing method, device, system and electronic equipment Download PDFInfo
- Publication number
- CN109144683A CN109144683A CN201710506427.2A CN201710506427A CN109144683A CN 109144683 A CN109144683 A CN 109144683A CN 201710506427 A CN201710506427 A CN 201710506427A CN 109144683 A CN109144683 A CN 109144683A
- Authority
- CN
- China
- Prior art keywords
- task
- pending
- message
- retries
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/545—Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/12—Accounting
- G06Q40/123—Tax preparation or submission
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Finance (AREA)
- General Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- General Business, Economics & Management (AREA)
- Debugging And Monitoring (AREA)
Abstract
This application involves task processing method, device, system and electronic equipment, method includes: the task message obtained in obstruction queue, and the task message includes at least task definition and task strategy;The pending time of the task message is calculated according to present system time and the task strategy;Pending task is generated according to the task definition and the pending time;The pending task is executed in the pending time.The technical solution of the application can provide the rule of honouring an agreement of customization for operation system, can be reduced manpower intervention to reduce the risk artificially to malfunction, and improve treatment effeciency, can also further support the parallel expansion of task processing unit.
Description
Technical field
This application involves computer application technologies, in particular to task processing method, device, system and electricity
Sub- equipment.
Background technique
Under current production environment, many business bar lines all have following application scenarios: such as network is obstructed to be caused to connect
It mouthful cannot access, carry out retrying guarantee business normal;MQ message is regularly sent, closes production environment at the specified time point
The business scenarios such as timed task worker.Many scenes require manpower intervention, there is the risk artificially to malfunction, and treatment effeciency
It is low.
In the related technology, the application for docking the message components such as JMQ or task engine can be supported specified time in service exception
Several retries, but reaches the mission failure after maximum times.Manpower intervention is needed to carry out retracting processing.
There are the following problems for above-mentioned the relevant technologies: firstly, not being able to satisfy incremental retry mechanism, a lot of operation systems are reaching
After maximum reattempt times, it is desirable to after 2 hours, after 4 hours, retried again after 8 hours, to guarantee the normal operation of business, and
Current retry mechanism is not able to satisfy above-mentioned requirements.Secondly, a certain task cannot periodically be executed, for example production environment is closed in timing
Task worker, timing batch calls the scenes such as specified interface, but above-mentioned technology does not have corresponding solution, and needs people
Work intervention, inefficiency.
Summary of the invention
The application discloses task processing method, to improve treatment effeciency.
Other characteristics and advantages of the invention will be apparent from by the following detailed description, or partially by the present invention
Practice and acquistion.
According to the first aspect of the invention, a kind of task processing method is provided, comprising:
The task message in obstruction queue is obtained, the task message includes at least task definition and task strategy;
The pending time of the task message is calculated according to present system time and the task strategy;
Pending task is generated according to the task definition and the pending time;
The pending task is executed in the pending time.
According to some embodiments of the present invention, after generating the pending task further include: by described pending
Business is added in the task ordered queue of setting;Executing the pending task in the pending time includes: to pass through task
Execution thread takes out the pending task from the task ordered queue, executes in the pending time described pending
Task.
According to some embodiments of the present invention, the pending task is added in the task ordered queue of setting and is wrapped
It includes: the pending task is added in the Redis of setting.
According to some embodiments of the present invention, after generating the pending task further include: by described pending
The information of business is stored into database;The pending task is taken out from the task ordered queue by task execution thread
It include: when the task execution thread is polled to the pending task from the Redis of the setting, from the database
The taking-up pending task information.
According to some embodiments of the present invention, the pending task is added in the task ordered queue of setting and is wrapped
It includes: determining the pending task in the task ordered queue of the setting according to the execution time of the pending task
Position, the pending task is added to the position of the task ordered queue of the setting.
According to some embodiments of the present invention, the method also includes: it is described wait hold when being executed in pending time
Row mission failure, obtain the task message number of retries and maximum can number of retries, the number of retries is updated
Add one for the number of retries, when the updated number of retries be less than the maximum can number of retries when, to the resistance
It fills in queue and sends the task message.
According to some embodiments of the present invention, the task message obtained in obstruction queue includes: by task creation thread
The task message is taken out from the obstruction queue of MQ message queue.
According to some embodiments of the present invention, it is executed after described pending in the pending time further include: if
It runs succeeded, then sends filing message to the MQ message queue, so that the MQ obtained the task message and execution
As a result persistent storage is carried out.
According to some embodiments of the present invention, the task message includes the message and/or timed task of repeating transmission task
Message.
According to the second aspect of the invention, a kind of Task Processing Unit is provided comprising:
Task acquiring unit, for obtaining the task message in obstruction queue, the task message is included at least in task
Appearance and task strategy;
Time determination unit, for according to present system time and the task strategy calculate the task message wait hold
The row time;
Task creation unit, for generating pending task according to the task definition and the pending time;
Task executing units, for executing the pending task in the pending time.
According to some embodiments of the present invention, the task creation unit be also used to generate the pending task it
Afterwards: the pending task is added in the task ordered queue of setting;The task executing units are used for: being held by task
Line journey takes out the pending task from the task ordered queue, executes described pending in the pending time
Business.
According to some embodiments of the present invention, the task creation unit is also used to: the pending task is added to
In the Redis of setting.
According to some embodiments of the present invention, the task creation unit is also used to, generate the pending task it
Afterwards, the information of the pending task is stored into database;The task executing units are also used to: when the task execution
When thread is polled to the pending task from the Redis of the setting, described pending of the taking-up from the database
The information of business.
According to some embodiments of the present invention, the task creation unit is also used to: according to the institute of the pending task
State execute the time determine that in the position of the task ordered queue of the setting, the pending task is added for the pending task
It is added to the position of the task ordered queue of the setting.
According to some embodiments of the present invention, described device further includes failure handling unit, for when described pending
Time executes the pending mission failure, obtain the task message number of retries and maximum can number of retries, by institute
It states number of retries and is updated to the number of retries and add one, can be retried when the updated number of retries is less than the maximum
When number, the task message is sent to the obstruction queue.7, device as described in claim 1, which is characterized in that obtain
The task message blocked in queue includes: to take out the task from the obstruction queue of MQ message queue by task creation thread
Message.
According to some embodiments of the present invention, described device further includes persistence processing unit, for described pending
After time executes described pending, if running succeeded, filing message is sent to the MQ message queue, so that the MQ
To the task message and execute obtained result progress persistent storage.
According to some embodiments of the present invention, the task message includes the message and/or timed task of repeating transmission task
Message.
According to the third aspect of the invention we, a kind of task processing system, including route device, at least one task weight are provided
Trial assembly is set and number statistic device;
The route device is used for, and retries the task message in device distribution obstruction queue at least one described task,
Wherein the task message includes at least task definition and task strategy;
The task retries device and is used for, and obtains the task message that the route device is distributed, when according to current system
Between and acquired task message task strategy, the pending time of acquired task message is calculated, according to acquired
The task definition of task message and the pending time generate pending task, execute in the pending time described wait hold
Row task;
The number statistic device is used to manage the number of retries of the task message and maximum can number of retries.
According to some embodiments of the present invention, the pending mission failure is executed when the task retries device, from institute
State the number of retries that the task message is obtained in number statistic device and maximum can number of retries, the number is counted and is filled
The number of retries of task message described in setting is updated to the number of retries and adds one, judges the updated number of retries
Whether be less than the maximum can number of retries, if then to the obstruction queue transmission task message.
According to the fourth aspect of the invention, a kind of electronic equipment is provided, comprising: processor;Memory is stored for handling
The instruction of device control such as any one of first aspect operation.
According to the fifth aspect of the invention, a kind of computer readable storage medium is provided, computer program is stored thereon with,
The step as described in any one of first aspect is realized when the program is executed by processor.
The technical solution that embodiments herein provides can include the following benefits:
The technical solution of the application can provide the rule of honouring an agreement of customization for operation system, can be reduced manpower intervention to drop
The low risk artificially to malfunction, and treatment effeciency is improved, it can also further support the parallel expansion of task processing unit.It should manage
Solution, the above general description and the following detailed description are merely exemplary, can not limit the present invention.
Detailed description of the invention
Its example embodiment is described in detail by referring to accompanying drawing, above and other feature of the invention and advantage will become more
Add obvious.
Fig. 1 shows task processing method according to an embodiment of the invention;
Fig. 2 shows the system architecture diagrams for platform of honouring an agreement described in example according to another embodiment of the present invention;
Fig. 3 shows the interaction diagrams of task message storage according to an embodiment of the invention;
Fig. 4 shows the interaction diagrams according to an embodiment of the invention for taking out task message;
Fig. 5 shows the interaction diagrams of task message processing according to an embodiment of the invention;
Fig. 6 shows the interaction diagrams that pending task according to an embodiment of the invention enters task ordered queue;
Fig. 7 shows the block diagram of Task Processing Unit according to an embodiment of the invention;
Fig. 8 shows the schematic diagram of task processing system according to an embodiment of the invention;
Fig. 9 shows electronic equipment according to an embodiment of the invention.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be real in a variety of forms
It applies, and is not understood as limited to embodiment set forth herein;On the contrary, thesing embodiments are provided so that the present invention will be comprehensively and complete
It is whole, and the design of example embodiment is comprehensively communicated to those skilled in the art.Identical appended drawing reference indicates in figure
Same or similar part, thus repetition thereof will be omitted.
In addition, described feature, structure or characteristic can be incorporated in one or more implementations in any suitable manner
In example.In the following description, many details are provided to provide and fully understand to the embodiment of the present invention.However,
It will be appreciated by persons skilled in the art that technical solution of the present invention can be practiced without one or more in specific detail,
Or it can be using other methods, constituent element, device, step etc..In other cases, it is not shown in detail or describes known side
Method, device, realization or operation are to avoid fuzzy each aspect of the present invention.
Block diagram shown in the drawings is only functional entity, not necessarily must be corresponding with physically separate entity.
I.e., it is possible to realize these functional entitys using software form, or realized in one or more hardware modules or integrated circuit
These functional entitys, or these functional entitys are realized in heterogeneous networks and/or processor device and/or microcontroller device.
Flow chart shown in the drawings is merely illustrative, it is not necessary to including all content and operation/step,
It is not required to execute by described sequence.For example, some operation/steps can also decompose, and some operation/steps can close
And or part merge, therefore the sequence actually executed is possible to change according to the actual situation.
Fig. 1 shows task processing method according to an embodiment of the invention, and the present embodiment is applicable to task processing system
Task retries the case where device handles the task message for being related to task strategy in system, such as timed task and retrying is appointed
Business.As shown in Figure 1, task processing method described in the present embodiment includes:
In step s 110, the task message in obstruction queue is obtained.
Wherein the task message may include the message of repeating transmission task, message of timed task etc..The task message is extremely
It less include task definition and task strategy.
Such as task message can be taken out from the obstruction queue of MQ message queue by task creation thread.If task
It include that multiple tasks retry device in processing system, then system may include appoints for taking out from the obstruction queue of MQ message queue
Business message retries device distribution to the multiple task, and task retries device and then receives being distributed for task from the route device
Message.
In the step s 120, according to present system time and the task strategy calculate the task message it is pending when
Between.
In step s 130, pending task is generated according to the task definition and the pending time.
In step S140, the pending task is executed in the pending time.
The technical solution of the present embodiment can calculate automatically the pending time according to task strategy after receiving task message,
Pending task is automatically generated, and is executed on time, can be reduced manpower intervention to reduce the risk artificially to malfunction, and task can be improved
Treatment effeciency.
It can be obtained according to some embodiments of the present invention when executing the pending mission failure in the pending time
Take the task message number of retries and maximum can number of retries, the number of retries is updated to described retried time
Number plus one, when the updated number of retries be less than the maximum can number of retries when, to the obstruction queue transmission described in
Task message.
According to some embodiments of the present invention, the pending task can also be added after generating the pending task
It is added in the task ordered queue of setting, such as is added in the Redis of setting, so as to can be held by task when the task of execution
Line journey takes out the pending task from the task ordered queue, executes described pending in the pending time
Business.Generation can be allowed to operate respectively by different threads to task and execution task in this way, achieve the effect that parallel processing, from
And task treatment effeciency can be improved.
In order to avoid causing task processing careless omission when Redis is unreliable, according to some embodiments of the present invention, generating
The information of the pending task can also be stored into database after the pending task, it can with increase task processing
By property, avoid omitting.
In such cases, when the task execution thread is polled to the pending task from the Redis of the setting
When, from the information of the taking-up pending task of the database.The pending task completed for processing, from Redis
After middle deletion, it is also desirable to delete from the database in time, guarantee the consistency of data.Data are checked according to certain strategy
Pending task in library, such as periodically check in database whether there is untreated pending task, if there is legacy tasks timely
It is handled.
According to some embodiments of the present invention, when the pending task being added in the task ordered queue of setting,
The pending task can be determined in the task ordered queue of the setting according to the execution time of the pending task
Position, the pending task is added to the position of the task ordered queue of the setting.To guarantee according to holding
The sequencing of row time places pending task, sequentially to take out task execution from the task ordered queue, reduces to appointing
The execution time of business is continually judged, it is only necessary to judge whether the pending time of the pending task of the tail of the queue of queue arrives
It reaches, task treatment effeciency can be improved.
According to some embodiments of the present invention, after pending time executes described pending, if execute at
Function can also send filing message to the MQ message queue, so that the MQ is to the task message and executes obtained result
Persistent storage is carried out, to facilitate subsequent query and processing.
Present embodiment illustrates a kind of examples of task processing system described in example according to another embodiment of the present invention:
Platform of honouring an agreement illustrates the technical solution of the present embodiment for platform of honouring an agreement.Fig. 2 is shoe described in the example of the present embodiment
The about system architecture diagram of platform, as shown in Fig. 2, this is honoured an agreement, platform supports the access of multiple operation systems.Task retries device
The core of the platform, and multiple tasks can be supported to retry device lateral extension, to cope with large concurrent access.Multiple tasks retry
Device is dependent on number statistic device.
The platform of honouring an agreement through this embodiment, it is simple that operation system accesses the platform of honouring an agreement, and specifically includes: firstly,
The authorization of operation system, business function is carried out in platform of honouring an agreement, distributes permission code and token;Then, it is carried out in platform configuration of honouring an agreement
It is about regular, such as: it is retried by specified time interval, the interior scheduled date retries weekly;Then, maven dependence can be added, is introduced
Develop client packet;Finally configuration JSF interface, which relies on, completes platform that operation system access is honoured an agreement.
For task retries unit, it may include a database, an orderly team of Redis that a task, which retries unit,
Column, a pending obstruction queue.Can deployment extending transversely multiple retry unit.Fig. 3 shows an implementation according to the present invention
The interaction diagrams of the task message storage of example, as shown in figure 3, the method that the task message of the present embodiment is put in storage includes:
Task, which retries unit and pulls from MQ message-oriented middleware, retries task message, such as the task of retrying can be pulled from JMQ
Message.Retrying task message described in wherein can be the message retried or the message for periodically executing a certain task.Task weight
Examination unit goes out to retry the execution time of task according to present system time with policy calculation is retried, and is added to the MySQL of the unit
In database.In the Redis ordered queue that the task of retrying can be synchronously written.It should be noted that in the present embodiment, it is described wait hold
In row task ordered queue, element is sorted according to task execution time stamp.
Fig. 4 shows the interaction diagrams according to an embodiment of the invention for taking out task message, as shown in figure 4, wait hold
Row task timing obtains specified range task list (such as preceding 200 records) by ZRANGE from ordered queue, if worked as
The preceding time has been more than to retry to execute the time, and pending task is put into obstruction queue, is waited to be processed.
Fig. 5 shows the interaction diagrams of task message processing according to an embodiment of the invention, as shown in figure 5, implementing
Example task message processing exchange method include:
Step 1: the thread in task processing thread pool obtains pending task from obstruction queue, from pending queue
Delete the task.
Step 2: after deleting successfully, the query and retry Task Details from MySQL database, according to retrying task definition
Execution retries.
Step 3: retrying and successfully send filing JMQ message afterwards, and persistence retries task and processing result into Hbase.
Step 4: call number statistic device, such as number shown in Fig. 2 count micro services, obtain the task and have retried time
Number.
Step 5: number of retries is not present, then is put in storage preservation.Number of retries exists, and judges whether that reaching maximum retries valve
Value.
If after reaching maximum reattempt times, and access service system alarm switch is opened, then is alarmed.If not up to most
Big number of retries, then call number statistic device after number of retries being increased 1, number as shown in Figure 2 count micro services, carry out more
New operation
Fig. 6 shows the interaction diagrams that pending task according to an embodiment of the invention enters task ordered queue, such as
Shown in Fig. 6, the timed task in each unit can periodically go inquiry MySQL database, retry task root for qualified
It gives a mark, is saved in pending orderly task queue according to marking result, i.e. Redis ordered set according to the time is executed.
Wherein, in number statistic device, Key value create-rule can be organized as follows: NAME_SPACE+BIZ_
TYPE+EXECUTE_TYPE+EXECUTE_ID.Wherein NAME_SPACE is NameSpace, and different application systems is known for area,
BIZ_TYPE is type of service, for example including types of service such as order business, LOC business, global purchase business.EXECUTE_TYPE
To handle type, EXECUTE_ID is the mark of task message.
Value value is number of having honoured an agreement, initial value 0.
Illustrate the application of task processing system described in the present embodiment with several application examples below.
Application example one: equator platform latency order is declared.
Purchase the docking that bonded business has completed 8 bonded areas in the whole world.Each bonded area need to call service provider's interface into
Row order is declared.During declaring, interface is often adjusted obstructed, and system increases retry mechanism, after reaching number of retries, according to
It so will appear the order for much declaring failure.Access platform of honouring an agreement:
1) order can be sent and retry task to platform of honouring an agreement by equator platform
Specified task engine topic or the MQ topic retried, initialize retry rule (such as: retried after 1 hour
3 times, 10 minutes each interval times after platform of honouring an agreement retries 3 times, can will retry regular upgrading, and retry after being changed to 2 hours
6 times, 20 minutes each interval times).
2) it honours an agreement to retry unit and receive and retries message, can parse into the library mysql, prevent information drop-out;
3) it honours an agreement and retries unit message is stored to Redis ordered queue, score is calculated according to timestamp, guarantees that message has
Sequence;
4) retry unit assignment processing worker periodically can take message to be retried from Redis ordered queue;
5) after reaching maximum reattempt times, if also failed, platform of honouring an agreement be will call the police, by failure order hair mail to industry
Business side needs manpower intervention to handle.
Application example two: platform timing in equator closes difference and declares worker.
Equator platform cluster is disposed, and opens the worker much declared on every machine.For example storehouse, system liter are removed in warehouse
Grade pause is declared, suppresses the scenes such as single test, and timing is needed to close worker, and order opens worker.It is per treatment to require people
Work intervention, accessing platform of honouring an agreement includes:
1) platform transmission timing in equator closes worker message, time opening worker message to platform of honouring an agreement;
2) it honours an agreement and retries unit message is entered into the library mysql, redis ordered queue is arrived in synchronous storage;
3) platform of honouring an agreement can will close message, open message fixed time broadcast to all clustered machines, and each machine executes pass
It closes and opens.
Three: LOC system order of application example calls third party's interface propelling data after specifying the day period.
LOC business correlation order can at the appointed time call third party's interface propelling data after section, order be after 2 days
Call, order be to be called after 3 days.LOC service access platform of honouring an agreement includes:
1) loc system transmission honours an agreement message to platform of honouring an agreement;
Message of honouring an agreement includes required parameter, the end-point addresses of access, the relevant informations such as failure number of retries
2) it honours an agreement and retries unit message is entered into the library MySQL, Redis ordered queue is arrived in synchronous storage;
3) platform of honouring an agreement can calculate the time of propelling data, be put into Redis ordered queue according to the sequencing of time.
Platform of honouring an agreement can be executed periodically, and have unsuccessfully retry mechanism;
As above-mentioned application example as it can be seen that the technical solution of the task processing system supplied shown in the embodiment of the present invention, using list
Memberization thought realizes task processing system that can be extending transversely, such as platform mechanism of honouring an agreement, and has both been able to satisfy different rules of honouring an agreement
Task is retried, system can facilitate extension again, and the overlapping development of same requirements is avoided to work.In the case where allowing business development, energy
Enough meet the various normal execution based on Regular Task of honouring an agreement, can be good at the normal processing and circulation of guarantee business.
Fig. 7 shows the block diagram of Task Processing Unit according to an embodiment of the invention, as shown in fig. 7, the present embodiment institute
The Task Processing Unit stated includes task acquiring unit 710, time determination unit 720, task creation unit 730 and task
Execution unit 740.
The task acquiring unit 710 is configured to obtain the task message in obstruction queue, and the task message is extremely
It less include task definition and task strategy;
The time determination unit 720 is configured to according to present system time and task strategy calculating
The pending time of task message;
The task creation unit 730 be configured to be generated according to the task definition and pending time to
Execution task;
The task executing units 740 are configured to execute the pending task in the pending time.
According to some embodiments of the present invention, the task creation unit 730 is also used to generating the pending task
Later: the pending task is added in the task ordered queue of setting;The task executing units 740 are used for: being passed through
Task execution thread takes out the pending task from the task ordered queue, pending time execute it is described to
Execution task.
According to some embodiments of the present invention, the task creation unit 730 is also used to: the pending task is added
Into the Redis of setting.
According to some embodiments of the present invention, the task creation unit 730 is also used to, and is generating the pending task
Later, the information of the pending task is stored into database;The task executing units 740 are also used to: when described
Business execution thread is when being polled to the pending task from the Redis of the setting, described in the taking-up from the database to
The information of execution task.
According to some embodiments of the present invention, the task creation unit 730 is also used to: according to the pending task
The execution time determines the position of task ordered queue of the pending task in the setting, by the pending task
It is added to the position of the task ordered queue of the setting.
According to some embodiments of the present invention, described device further includes failure handling unit (being not shown in Fig. 7), for working as
The pending mission failure is executed in the pending time, the number of retries and maximum for obtaining the task message can weigh
Number is tried, the number of retries is updated to the number of retries and adds one, when the updated number of retries is less than institute
State maximum can number of retries when, send the task message to the obstruction queue.
According to some embodiments of the present invention, the task message obtained in obstruction queue includes: by task creation thread
The task message is taken out from the obstruction queue of MQ message queue.
According to some embodiments of the present invention, described device further includes persistence processing unit (being not shown in Fig. 7), is used for
After the pending time executes described pending, if running succeeded, filing is sent to the MQ message queue and is disappeared
Breath, so that the MQ is to the task message and executes obtained result progress persistent storage.
According to some embodiments of the present invention, the task message includes the message and/or timed task of repeating transmission task
Message.
About the device in above-described embodiment, wherein each unit executes the concrete mode of operation in related this method
Embodiment in be described in detail, no detailed explanation will be given here.
Task processing method provided by embodiment of the present invention method can be performed in Task Processing Unit provided in this embodiment,
Have the corresponding functional module of execution method and beneficial effect.
Fig. 8 shows the schematic diagram of task processing system according to an embodiment of the invention, as shown in figure 8, the present embodiment
The task processing system includes that route device 820, at least one task retry device 830 and number statistic device
840;
The route device 820 is used for, and is retried in the distribution obstruction queue 810 of device 830 at least one described task
Task message, wherein the task message includes at least task definition and task strategy;
The task retries device 830 and is used for, and the task message that the route device 820 is distributed is obtained, according to current
The task strategy of system time and acquired task message calculates the pending time of acquired task message, according to institute
The task definition of the task message of acquisition and the pending time generate pending task, execute institute in the pending time
State pending task;
The number statistic device 840 is used to manage the number of retries of the task message and maximum can number of retries.
According to some embodiments of the present invention, the pending mission failure is executed when the task retries device 830, from
Obtained in the number statistic device 840 task message number of retries and maximum can number of retries, by the number
The number of retries of task message described in statistic device 840 is updated to the number of retries and adds one, judges updated institute
State number of retries whether be less than the maximum can number of retries, if then sending the task message to the obstruction queue.
Fig. 9 shows electronic equipment according to an embodiment of the invention, as shown in figure 9, electronic equipment 900 may include processing
Device 910, memory 920, transmitter 930 and receiver 940.
Memory 920 can store the instruction that operation processing is controlled for processor 910.Memory 920 may include volatibility
Or nonvolatile memory, as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM),
Erasable Programmable Read Only Memory EPROM (EPROM), programmable read only memory (PROM), read-only memory (ROM) etc., the present invention
It is not limited in this respect.
Processor 910 can call the instruction stored in memory 920 to control relevant operation.According to an embodiment, memory
920 storages control the instruction operated below for processor 910: obtaining the task message in obstruction queue, the task message
Including at least task definition and task strategy;According to present system time and the task strategy calculate the task message to
Execute the time;Pending task is generated according to the task definition and the pending time;It is executed in the pending time
The pending task.
It can be readily appreciated that memory 920, which can also be stored, controls other operations according to an embodiment of the present invention for processor 910
Instruction, which is not described herein again.
The also controllable transmitter 930 of processor 910 and receiver 940 send and receive signals.
By above detailed description, those skilled in the art it can be readily appreciated that according to the system in the embodiment of the present invention and
Method has one or more of the following advantages.
According to an embodiment of the invention, when executing the pending mission failure in pending time, described in acquisition
The number of retries and maximum of task message can number of retries, the number of retries is updated to the number of retries and is added
One, when the updated number of retries be less than the maximum can number of retries when, to the obstruction queue transmission task
Message.
According to some embodiments, the present invention also provides a kind of non-transitorycomputer readable storage mediums, for example including finger
The memory of order, above-metioned instruction can be executed by the processor of device to complete the above method.For example, non-transitory is computer-readable
Storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage devices etc..When depositing
It when instruction in storage media is executed by the processor of terminal, enables the terminal to execute following methods: obtain in obstruction queue
Task message, the task message include at least task definition and task strategy;According to present system time and the task plan
Approximation calculates the pending time of the task message;Pending is generated according to the task definition and the pending time
Business;The pending task is executed in the pending time.
It will be understood by those skilled in the art that attached drawing is the schematic diagram of example embodiment, module or process in attached drawing
Necessary to not necessarily implementing the present invention, therefore it cannot be used for limiting the scope of the invention.
It will be appreciated by those skilled in the art that above-mentioned each module can be distributed in device according to the description of embodiment, it can also
Uniquely it is different from one or more devices of the present embodiment with carrying out corresponding change.The module of above-described embodiment can be merged into
One module, can also be further split into multiple submodule.
It is particularly shown and described exemplary embodiment of the present invention above.It should be understood that the present invention is not limited to institute's public affairs
The embodiment opened, on the contrary, it is intended to cover comprising various modifications in the spirit and scope of the appended claims and wait
Effect arrangement.
Claims (15)
1. a kind of task processing method characterized by comprising
The task message in obstruction queue is obtained, the task message includes at least task definition and task strategy;
The pending time of the task message is calculated according to present system time and the task strategy;
Pending task is generated according to the task definition and the pending time;
The pending task is executed in the pending time.
2. the method as described in claim 1, which is characterized in that after generating the pending task further include: will be described
Pending task is added in the task ordered queue of setting;
Executing the pending task in pending time includes: by task execution thread from the task ordered queue
It is middle to take out the pending task, the pending task is executed in the pending time.
3. method according to claim 2, which is characterized in that the orderly team of task that the pending task is added to setting
It include: that the pending task is added in the Redis of setting in column.
4. method as claimed in claim 3, which is characterized in that after generating the pending task further include: will be described
The information of pending task is stored into database;
Taking out the pending task from the task ordered queue by task execution thread includes: when the task execution
When thread is polled to the pending task from the Redis of the setting, described pending of the taking-up from the database
The information of business.
5. method according to claim 2, which is characterized in that the orderly team of task that the pending task is added to setting
It include: to determine that the pending task has in the task of the setting according to the execution time of the pending task in column
The pending task is added to the position of the task ordered queue of the setting by the position of sequence queue.
6. the method as described in claim 1, which is characterized in that the method also includes: it is executed when in the pending time
The pending mission failure, obtain the task message number of retries and maximum can number of retries, retried described
Number is updated to the number of retries and adds one, when the updated number of retries be less than the maximum can number of retries when,
The task message is sent to the obstruction queue.
7. the method as described in claim 1, which is characterized in that the task message obtained in obstruction queue includes: to pass through task
Creation thread takes out the task message from the obstruction queue of MQ message queue.
8. the method for claim 7, which is characterized in that after the pending time executes described pending also
If including: to run succeeded, filing message is sent to the MQ message queue, so that the MQ is to the task message and execution
Obtained result carries out persistent storage.
9. the method as described in claim 1, which is characterized in that the task message includes the message of repeating transmission task and/or determines
When task message.
10. a kind of Task Processing Unit characterized by comprising
Task acquiring unit, for obtain obstruction queue in task message, the task message include at least task definition and
Task strategy;
Time determination unit, for according to present system time and the task strategy calculate the task message it is pending when
Between;
Task creation unit, for generating pending task according to the task definition and the pending time;
Task executing units, for executing the pending task in the pending time.
11. device as claimed in claim 10, which is characterized in that described device further includes failure handling unit, for working as
The pending time executes the pending mission failure, and the number of retries and maximum for obtaining the task message can retry
The number of retries is updated to the number of retries and adds one by number, when the updated number of retries is less than described
Maximum can number of retries when, send the task message to the obstruction queue.
12. a kind of task processing system, which is characterized in that retry device and number including route device, at least one task
Statistic device;
The route device is used for, and retries the task message in device distribution obstruction queue at least one described task, wherein
The task message includes at least task definition and task strategy;
The task retries device and is used for, and obtains the task message that the route device is distributed, according to present system time and
The task strategy of acquired task message calculates the pending time of acquired task message, according to acquired task
The task definition of message and the pending time generate pending task, execute described pending in the pending time
Business;
The number statistic device is used to manage the number of retries of the task message and maximum can number of retries.
13. task processing system as claimed in claim 12, which is characterized in that when the task retry device execute it is described to
Mission failure is executed, the number of retries and maximum that the task message is obtained from the number statistic device can retry secondary
The number of retries of task message described in the number statistic device is updated to the number of retries and adds one by number, judgement
The updated number of retries whether be less than the maximum can number of retries, if then sending described appoint to the obstruction queue
Business message.
14. a kind of electronic equipment characterized by comprising processor;Memory, storage is for processor control as weighed
Benefit requires the instruction of any one of 1-9 operation.
15. a kind of computer readable storage medium, is stored thereon with computer program, realized such as when which is executed by processor
Any one of the claim 1-9 step.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710506427.2A CN109144683A (en) | 2017-06-28 | 2017-06-28 | Task processing method, device, system and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710506427.2A CN109144683A (en) | 2017-06-28 | 2017-06-28 | Task processing method, device, system and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109144683A true CN109144683A (en) | 2019-01-04 |
Family
ID=64805512
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710506427.2A Pending CN109144683A (en) | 2017-06-28 | 2017-06-28 | Task processing method, device, system and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109144683A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109814997A (en) * | 2019-01-18 | 2019-05-28 | 创新奇智(广州)科技有限公司 | A kind of distributed freedom equilibrium artificial intelligence method for scheduling task and system |
CN110262878A (en) * | 2019-05-06 | 2019-09-20 | 平安科技(深圳)有限公司 | Timed task processing method, device, equipment and computer readable storage medium |
CN110347492A (en) * | 2019-07-15 | 2019-10-18 | 深圳前海乘势科技有限公司 | Distributed task dispatching method and apparatus based on time parameter method |
CN110389818A (en) * | 2019-06-19 | 2019-10-29 | 中国平安财产保险股份有限公司 | Timing task processing method, device, equipment and computer-readable storage medium |
CN110413384A (en) * | 2019-06-25 | 2019-11-05 | 腾讯科技(深圳)有限公司 | Delay task processing method and device, storage medium, electronic equipment |
CN110457126A (en) * | 2019-08-13 | 2019-11-15 | 杭州有赞科技有限公司 | A kind of asynchronous invoking method and system |
CN111367688A (en) * | 2020-02-28 | 2020-07-03 | 京东数字科技控股有限公司 | Service data processing method and device |
CN111694671A (en) * | 2020-06-12 | 2020-09-22 | 北京金山云网络技术有限公司 | Big data component management method, device, server, electronic equipment and system |
CN112087520A (en) * | 2020-09-14 | 2020-12-15 | 深圳市欣视景科技股份有限公司 | Data processing method, device, equipment and computer readable storage medium |
CN112685191A (en) * | 2019-10-18 | 2021-04-20 | 北京京东振世信息技术有限公司 | Message processing method and device |
CN113392132A (en) * | 2021-05-07 | 2021-09-14 | 杭州数知梦科技有限公司 | Distributed caching method and system for IOT scene |
CN113434307A (en) * | 2021-06-22 | 2021-09-24 | 北京沃东天骏信息技术有限公司 | Task sending processing method, task processing method, device, system and equipment |
CN113760513A (en) * | 2021-09-16 | 2021-12-07 | 康键信息技术(深圳)有限公司 | Distributed task scheduling method, device, equipment and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2004061663A2 (en) * | 2002-12-31 | 2004-07-22 | Globespanvirata Incorporated | System and method for providing hardware-assisted task scheduling |
CN102081757A (en) * | 2009-11-30 | 2011-06-01 | 中国移动通信集团天津有限公司 | Report making method and system |
CN104346215A (en) * | 2013-08-07 | 2015-02-11 | 中兴通讯股份有限公司 | Task scheduling service system and method |
CN105700943A (en) * | 2015-12-31 | 2016-06-22 | 上海百事通信息技术股份有限公司 | Distributed task scheduling method and system |
-
2017
- 2017-06-28 CN CN201710506427.2A patent/CN109144683A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2004061663A2 (en) * | 2002-12-31 | 2004-07-22 | Globespanvirata Incorporated | System and method for providing hardware-assisted task scheduling |
CN102081757A (en) * | 2009-11-30 | 2011-06-01 | 中国移动通信集团天津有限公司 | Report making method and system |
CN104346215A (en) * | 2013-08-07 | 2015-02-11 | 中兴通讯股份有限公司 | Task scheduling service system and method |
CN105700943A (en) * | 2015-12-31 | 2016-06-22 | 上海百事通信息技术股份有限公司 | Distributed task scheduling method and system |
Cited By (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109814997A (en) * | 2019-01-18 | 2019-05-28 | 创新奇智(广州)科技有限公司 | A kind of distributed freedom equilibrium artificial intelligence method for scheduling task and system |
CN110262878A (en) * | 2019-05-06 | 2019-09-20 | 平安科技(深圳)有限公司 | Timed task processing method, device, equipment and computer readable storage medium |
CN110262878B (en) * | 2019-05-06 | 2024-03-08 | 平安科技(深圳)有限公司 | Timed task processing method, device, equipment and computer readable storage medium |
CN110389818A (en) * | 2019-06-19 | 2019-10-29 | 中国平安财产保险股份有限公司 | Timing task processing method, device, equipment and computer-readable storage medium |
CN110413384A (en) * | 2019-06-25 | 2019-11-05 | 腾讯科技(深圳)有限公司 | Delay task processing method and device, storage medium, electronic equipment |
CN110413384B (en) * | 2019-06-25 | 2024-03-01 | 腾讯科技(深圳)有限公司 | Delay task processing method and device, storage medium and electronic equipment |
CN110347492A (en) * | 2019-07-15 | 2019-10-18 | 深圳前海乘势科技有限公司 | Distributed task dispatching method and apparatus based on time parameter method |
CN110457126A (en) * | 2019-08-13 | 2019-11-15 | 杭州有赞科技有限公司 | A kind of asynchronous invoking method and system |
CN112685191A (en) * | 2019-10-18 | 2021-04-20 | 北京京东振世信息技术有限公司 | Message processing method and device |
CN112685191B (en) * | 2019-10-18 | 2023-09-22 | 北京京东振世信息技术有限公司 | Message processing method and device |
CN111367688A (en) * | 2020-02-28 | 2020-07-03 | 京东数字科技控股有限公司 | Service data processing method and device |
CN111694671B (en) * | 2020-06-12 | 2023-09-01 | 北京金山云网络技术有限公司 | Big data component management method, device, server, electronic equipment and system |
CN111694671A (en) * | 2020-06-12 | 2020-09-22 | 北京金山云网络技术有限公司 | Big data component management method, device, server, electronic equipment and system |
CN112087520A (en) * | 2020-09-14 | 2020-12-15 | 深圳市欣视景科技股份有限公司 | Data processing method, device, equipment and computer readable storage medium |
CN112087520B (en) * | 2020-09-14 | 2023-08-22 | 深圳市欣视景科技股份有限公司 | Data processing method, device, equipment and computer readable storage medium |
CN113392132A (en) * | 2021-05-07 | 2021-09-14 | 杭州数知梦科技有限公司 | Distributed caching method and system for IOT scene |
CN113434307A (en) * | 2021-06-22 | 2021-09-24 | 北京沃东天骏信息技术有限公司 | Task sending processing method, task processing method, device, system and equipment |
CN113760513A (en) * | 2021-09-16 | 2021-12-07 | 康键信息技术(深圳)有限公司 | Distributed task scheduling method, device, equipment and medium |
CN113760513B (en) * | 2021-09-16 | 2024-06-18 | 康键信息技术(深圳)有限公司 | Distributed task scheduling method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109144683A (en) | Task processing method, device, system and electronic equipment | |
CN108595157B (en) | Block chain data processing method, device, equipment and storage medium | |
US7421546B2 (en) | Intelligent state engine system | |
US7469405B2 (en) | System and method for scheduling execution of cross-platform computer processes | |
US6014673A (en) | Simultaneous use of database and durable store in work flow and process flow systems | |
US8140523B2 (en) | Decision based system for managing distributed resources and modeling the global optimization problem | |
CN109120678A (en) | The method and apparatus of service tray for distributed memory system | |
CN107665234A (en) | Method for processing business, device, server and storage medium | |
US11133991B2 (en) | Consolidating manufacturing intelligence event queue items | |
US20030014551A1 (en) | Framework system | |
CN106484321A (en) | A kind of date storage method and data center | |
CN105765555A (en) | Strict queue ordering in distributed system | |
CN110336859A (en) | Task scheduling system under multi-tenant environment | |
US12154045B2 (en) | Reservation of lock box facilities | |
CN108664343A (en) | A kind of stateful call method and device of micro services | |
CN113391901A (en) | RPA robot management method, device, equipment and storage medium | |
CN112925614B (en) | Distributed transaction processing method, device, medium and equipment | |
CN110347735A (en) | The data forwarding of configurationization mends processing method, device and readable storage medium storing program for executing extremely | |
CN116701011A (en) | Algorithm service dispatching management system based on rule engine | |
CN113297216A (en) | Real-time storage method for space flight measurement and control data | |
US20240036928A1 (en) | Automatic machine learning-based processing with temporally inconsistent events | |
CN114217875A (en) | Method, device and equipment for processing order and storage medium | |
CN109901933A (en) | The operating method and device of operation system, storage medium, electronic device | |
US12073340B1 (en) | Accurate individual queue level metric forecasting for virtual contact center queues with insufficient data, using models trained at higher granularity level | |
CN106713023A (en) | CAM table operating method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190104 |