Delay message processing method and device
By sending delay task messages to the message queue in the self-service equipment industry and diversion and resend based on the preset delay time, the problem of delay processing and global queueing processing is solved, improving system performance and avoiding messages Lost.
Patent Information
- Application Number
- CN202411339190.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-02-11
AI Technical Summary
The existing technology fails to effectively take into account the delay processing and global queue processing requirements of tasks in the self-service equipment industry, resulting in poor system performance and easy message loss.
By controlling multiple target services, sending delay task messages to the message queue, diversion of messages based on the preset delay time, and resend them to the message queue when the delay time expires, for consumption by target service.
It realizes accurate delay processing and global queuing processing of delayed task messages, improves system performance, avoids message loss, and takes into account the delay and queuing needs of each task.
Smart Images

Figure CN119415279A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of message processing, and in particular to a delayed message processing method and device. Background Art
[0002] In the self-service equipment industry, more and more tasks require delayed processing, such as order confirmation, order review, and incoming status review, etc. In addition, there are some tasks that require global queuing processing, such as inventory delivery, image delivery, etc., but there is currently no relatively complete way to take into account the needs of each task for delayed processing and global queuing processing, resulting in poor system performance and easy message loss. Summary of the invention
[0003] The embodiments of the present application provide a delayed message processing method and device to solve the technical problem that there is currently no relatively complete way to take into account the needs of each task for delayed processing and global queuing processing, resulting in poor system performance and easy loss of messages.
[0004] In a first aspect, an embodiment of the present application provides a delayed message processing method, including: Control multiple target services and send their respective delayed task messages to the message queue; Diverting the delayed task message based on the preset delay duration of the delayed task message; When the preset delay time of the delayed task message after diversion expires, the expired delayed task message is sent to the message queue, so that the multiple target services can consume the expired delayed task messages respectively.
[0005] In one embodiment, the diverting the delayed task message based on the preset delay duration of the delayed task message includes: If the preset delay duration is greater than the duration threshold, the first delay service is controlled to send the first delay task message corresponding to the preset delay duration in the message queue to the sequential storage unit; If the preset delay duration is less than or equal to the duration threshold, the first delay service is controlled to send the second delay task message corresponding to the preset delay duration in the message queue to the time wheel.
[0006] In one embodiment, after sending the first delayed task message corresponding to the preset delay duration in the message queue to the sequential storage unit, the method includes: If the currently required delay duration of the first delayed task message decreases from the preset delay duration to the duration threshold, controlling the scheduling service to schedule the first delayed task message in the sequential storage unit to the second delayed service; Control the second delayed service and send the first delayed task message to the time wheel.
[0007] In one embodiment, when the preset delay time of the delayed task message after diversion expires, sending the expired delayed task message to the message queue includes: When the preset delay time of the target delayed task message in the time round expires, controlling the target delayed service to send the expired target delayed task message to the message queue; The target delayed task message includes the first delayed task message and / or the second delayed task message, and the target delayed service includes the first delayed service and / or the second delayed service.
[0008] In one embodiment, after sending the expired delayed task message to the message queue, the method includes: Control the target delay service to stop receiving target delay task messages; The target delayed task message includes the first delayed task message and / or the second delayed task message, and the target delayed service includes the first delayed service and / or the second delayed service.
[0009] In one embodiment, after sending the first delayed task message corresponding to the preset delay duration in the message queue to the sequential storage unit, the method further includes: The sequential storage unit is controlled to sort the first delayed task messages therein according to the currently required delay duration.
[0010] In a second aspect, an embodiment of the present application provides a delayed message processing device, including: The delayed message sending module is used to: control multiple target services and send their respective delayed task messages to the message queue; A diversion module, used to: divert the delayed task message based on the preset delay time of the delayed task message; The expired message sending module is used to: when the preset delay time of the delayed task message after diversion expires, send the expired delayed task message to the message queue, so that the multiple target services can consume their respective expired delayed task messages.
[0011] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing a computer program, wherein when the processor executes the program, the steps of the delayed message processing method described in the first aspect are implemented.
[0012] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the delayed message processing method described in the first aspect.
[0013] In a fifth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, including a computer program, which, when executed by a processor, implements the steps of the delayed message processing method described in the first aspect.
[0014] The delayed message processing method and device provided in the present application control multiple target services, send their respective delayed task messages to a message queue, divert the delayed task messages based on a preset delay duration of the delayed task messages, and when the preset delay duration of the diverted delayed task messages expires, send the expired delayed task messages to the message queue so that the multiple target services can consume their respective expired delayed task messages. This application diverts the delayed task messages in the message queue according to the preset delay duration. After diversion, the current required delay duration of the delayed task message gradually decreases from the preset delay duration to zero. When the preset delay duration expires, the delayed task message is resent to the message queue so that the actual delay duration of the delayed task message accurately reaches its preset delay duration before being processed. On the one hand, the delayed task message is processed only after the preset delay duration has expired, thereby realizing the delayed processing of the delayed task message. On the other hand, the delayed task message is resent to the message queue in the order in which the preset delay duration expires, thereby realizing the global queuing processing of the delayed task message. In summary, this application can take into account the needs of each task for delayed processing and global queuing processing, improve system performance, and avoid message loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 This is one of the flowcharts of the delayed message processing method provided in the embodiment of the present application; Figure 2 This is the second flowchart of the delayed message processing method provided in the embodiment of the present application; Figure 3 It is a structural diagram of a delayed message processing device provided in an embodiment of the present application; Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0018] It should be noted that in the description of the embodiments of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. The orientation or position relationship indicated by the terms "upper", "lower" and the like is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those skilled in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0019] The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0020] Figure 1 This is one of the flowcharts of the delayed message processing method provided in the embodiment of the present application; Figure 2 This is the second flow chart of the delayed message processing method provided in the embodiment of the present application.
[0021] Reference Figure 1 , the embodiment of the present application provides a delayed message processing method, which may include: 101. Control multiple target services and send their respective delayed task messages to the message queue; 102. Divert the delayed task message based on the preset delay time of the delayed task message; 103. When the preset delay time of the delayed task message after diversion expires, the expired delayed task message is sent to a message queue so that multiple target services can consume their respective expired delayed task messages.
[0022] Reference Figure 2 : In step 101, the multiple target services may include web services, payment services, command prompt services, delayed services and mobile services, and may also include other types of services, which are not limited here.
[0023] The message queue may be a message queue implemented based on Redis, or a message queue implemented in other ways, which is not limited here.
[0024] It should be noted that the topics of delayed task messages are classified in the message queue. When controlling multiple target services and sending their respective delayed task messages to the message queue, each delayed task message needs to be sent to the corresponding topic category.
[0025] In step 102, the preset delay durations of the delayed task messages may be the same or different, which is not limited here. Each delayed task message has its own corresponding preset delay duration.
[0026] In step 103, after diversion, if the preset delay duration of any delayed task message expires, it will be resent to the message queue for consumption by its corresponding target service. For example, if the preset delay duration of a delayed task message of a web service expires, the delayed task message will be resent to the message queue for consumption by the web service.
[0027] It should be noted that as time passes after the diversion, the current required delay duration of each delayed task message is reduced from its own preset delay duration. For example, the preset delay duration of a delayed task message is 10 seconds. After the diversion, the countdown starts from 10 seconds, and the current required delay duration decreases accordingly. When the countdown ends, the preset delay duration of 10 seconds expires.
[0028] The delayed message processing method provided in this embodiment controls multiple target services, sends their respective delayed task messages to a message queue, and shunts the delayed task messages based on the preset delay duration of the delayed task messages. When the preset delay duration of the shunted delayed task messages expires, the expired delayed task messages are sent to the message queue so that multiple target services can consume the expired delayed task messages. In this embodiment, the delayed task messages in the message queue are shunted according to the preset delay duration. After the shunt, the current required delay duration of the delayed task message gradually decreases from the preset delay duration to zero. When the preset delay duration expires, the delayed task message is resent to the message queue so that the actual delay duration of the delayed task message accurately reaches its preset delay duration before being processed. On the one hand, the delayed task message is processed only after the preset delay duration, thereby realizing the delayed processing of the delayed task message. On the other hand, the delayed task message is resent to the message queue in the order of the expiration of the preset delay duration, thereby realizing the global queuing processing of the delayed task message. In summary, this embodiment can take into account the requirements of each task for delayed processing and global queue processing, improve system performance, and avoid message loss.
[0029] Reference Figure 2 , based on the preset delay time of the delayed task message, diverting the delayed task message may include: If the preset delay duration is greater than the duration threshold, the first delay service is controlled to send the first delay task message corresponding to the preset delay duration in the message queue to the sequential storage unit; If the preset delay duration is less than or equal to the duration threshold, the first delay service is controlled to send the second delay task message corresponding to the preset delay duration in the message queue to the time wheel.
[0030] The above duration threshold can be set according to actual needs and is not limited here. In this embodiment, the duration threshold can be set to 5 seconds. When the preset delay duration of any delayed task message is greater than 5 seconds, the first delayed service is controlled to read the delayed task message from the message queue, and then the delayed task message is sent to the sequential storage unit; when the preset delay duration of any delayed task message is less than or equal to 5 seconds, the first delayed service is controlled to read the delayed task message from the message queue, and then the delayed task message is sent to the time wheel.
[0031] This embodiment classifies the delayed task messages in the message queue into the first delayed task message and the second delayed task message through the duration threshold, and diverts the two to different areas. Since the preset delay duration of the first delayed task message is different from the preset delay duration of the second delayed task message, the second delayed task message that expires earlier than the preset delay duration needs to be processed as early as possible than the first delayed task message that expires later than the preset delay duration. In the case of limited design space for the time wheel, the first delayed task message that is processed later is excluded from the time wheel, which can avoid too many messages to be processed in the time wheel, so that the time wheel can concentrate on processing the more urgent second delayed task message, thereby improving the message processing efficiency of the time wheel.
[0032] Reference Figure 2 In one embodiment, after sending the first delayed task message corresponding to the preset delay time in the message queue to the sequential storage unit, the method may include: If the current required delay duration of the first delayed task message decreases from the preset delay duration to the duration threshold, the scheduling service is controlled to schedule the first delayed task message in the sequential storage unit to the second delayed service, and the second delayed service is controlled to send the first delayed task message to the time wheel.
[0033] Furthermore, after sending the first delayed task message corresponding to the preset delay duration in the message queue to the sequential storage unit, the sequential storage unit can also be controlled to sort the first delayed task messages inside it according to the currently required delay duration, and can be arranged in ascending or descending order, which is not limited here. It should be noted that the first delayed task message inside the sequential storage unit includes the most recently received first delayed task message and the first delayed task message previously received and whose current required delay duration has not yet decreased to the duration threshold. The current required delay duration of the former has not yet experienced a decrease, so it is the preset delay duration. The current required delay duration of the latter has experienced a decrease and is less than its preset delay duration. The inc instruction of Redis can be used to obtain the current required delay duration of all first delayed task messages in the sequential storage unit, and sort each first delayed task message based on the current required delay duration; After the sorting is completed, the real-time decrease in the current required delay of each first delayed task message in the sequential storage unit can be efficiently identified, and the first delayed task message whose current required delay duration decreases to the duration threshold can be promptly discovered and sent to the time wheel to wait for consumption.
[0034] Among them, the scheduling service can be scheduled every 5 seconds. The scheduling service and the second delay service are both distributed task services. The two can cooperate with each other in scheduling to improve the efficiency of message processing. In addition, since the first delayed task message in the sequential storage unit is scheduled to the time wheel when the current required delay duration decreases to 5 seconds, the time wheel also includes the second delayed task message with a preset delay duration less than or equal to 5 seconds that was previously diverted. After the delay expires, the delayed task message in the time wheel will be consumed by each target service. Therefore, scheduling at intervals of 5 seconds can ensure that after the current scheduling, most of the delayed task messages in the time wheel have been consumed before the next scheduling begins, thereby realizing an efficient closed loop of message processing.
[0035] Furthermore, a second delay service is used to send the first delayed task message in the sequential storage unit to the time wheel, so as to perform different message processing separately from the first delay service that sends the first delayed task message to the sequential storage unit, thereby avoiding the use of the same delay service to access messages in the sequential storage unit, resulting in memory overflow of the delay service.
[0036] Furthermore, a scheduling service is used to select a delay service, namely, a second delay service, to process the message, thereby avoiding repeated processing of the message by multiple delay services and wasting computing resources.
[0037] This embodiment can sort the first delayed task messages in the sequential storage unit according to the currently required delay duration, and can send the first delayed task messages to the time wheel for consumption in the order in which the currently required delay durations are reduced to the duration threshold, which helps the smooth progress of the global queuing. In this process, the distributed scheduling service and the second delay service cooperate with each other in scheduling, which can improve the efficiency of message processing and realize an efficient closed loop of message processing; the delay services that access messages to the sequential storage unit are separated, which can avoid memory overflow caused by the same delay service accessing messages; using the scheduling service to select a single delay service for message processing can avoid the waste of computing resources caused by repeated processing of messages by multiple delay services.
[0038] Reference Figure 2 In one embodiment, when the preset delay time of the delayed task message after diversion expires, sending the expired delayed task message to the message queue may include: When the preset delay time of the target delayed task message in the time wheel expires, the target delayed service is controlled to send the expired target delayed task message to the message queue; The target delayed task message includes a first delayed task message and / or a second delayed task message, and the target delayed service includes a first delayed service and / or a second delayed service.
[0039] Right now: If the preset delay time of the first delayed task message in the time wheel expires, controlling the second delayed service to send the expired first delayed task message to the message queue; If the preset delay time of the second delayed task message in the time wheel expires, the first delayed service is controlled to send the expired second delayed task message to the message queue.
[0040] In this embodiment, when the preset delay duration of the delayed task message in the time wheel expires, the corresponding delayed service is controlled to send the expired delayed task message to the message queue, which can improve the message processing efficiency and facilitate the target service to consume the expired delayed task message in time.
[0041] Reference Figure 2 In one embodiment, after sending the expired delayed task message to the message queue, the following steps are performed: Control the target delay service to stop receiving target delay task messages; The target delayed task message includes a first delayed task message and / or a second delayed task message, and the target delayed service includes a first delayed service and / or a second delayed service.
[0042] That is, the target delayed service is controlled to be closed gracefully. This embodiment can be implemented at the 10th second before the preset closing time, and the target delayed service is controlled to stop receiving the target delayed task message within 10 seconds and complete the processing of the message in the time wheel.
[0043] This embodiment adopts an elegant shutdown strategy for the target delayed service, which can ensure a smooth transition of its shutdown process and avoid message loss during the shutdown process.
[0044] Reference Figure 2 In one embodiment, a massage chair is used as an example to illustrate the technical solution of this application: After the user purchases a package, the massage chair can determine the length of time the massage service is provided. Based on the length of time, the control business side sends a delayed task message after the order is completed to a specific topic in the message queue, and determines whether the preset delay time of the delayed task message is greater than 5 seconds. The preset delay time is set based on the package selected by the user, and the preset delay time of the massage order is usually much greater than 5 seconds. Therefore, the first delayed service is controlled to send the delayed task message to the sequential storage unit for sorting. After that, every 5 seconds, the control scheduling service will dispatch the delayed task message with a preset delay time in the sequential storage unit decreasing to 5 seconds to the second delayed service, and the second delayed service is controlled to send these delayed task messages to the time wheel to wait for consumption. After the delayed task message in the time wheel expires, it will be pushed to the message queue with a specific topic, and the actual business will consume it according to the specific topic.
[0045] The delayed message processing device provided in an embodiment of the present application is described below. The delayed message processing device described below and the delayed message processing method described above can be referenced to each other.
[0046] Figure 3 Schematic diagram of the structure of the delayed message processing device provided in the embodiment of the present application. Figure 3 , the embodiment of the present application provides a delayed message processing device, which may include: The delayed message sending module 301 is used to: control multiple target services and send their respective delayed task messages to the message queue; The diversion module 302 is used to: divert the delayed task message based on the preset delay time of the delayed task message; The expired message sending module 303 is used to: when the preset delay time of the delayed task message after diversion expires, send the expired delayed task message to the message queue, so that the multiple target services can consume their respective expired delayed task messages.
[0047] The delayed message processing device provided in this embodiment controls multiple target services, sends their respective delayed task messages to the message queue, and shunts the delayed task messages based on the preset delay duration of the delayed task messages. When the preset delay duration of the shunted delayed task messages expires, the expired delayed task messages are sent to the message queue so that multiple target services can consume the expired delayed task messages. In this embodiment, the delayed task messages in the message queue are shunted according to the preset delay duration. After the shunt, the current required delay duration of the delayed task message gradually decreases from the preset delay duration to zero. When the preset delay duration expires, the delayed task message is resent to the message queue so that the actual delay duration of the delayed task message accurately reaches its preset delay duration before being processed. On the one hand, the delayed task message is processed only after the preset delay duration, thereby realizing the delayed processing of the delayed task message. On the other hand, the delayed task message is resent to the message queue in the order of the expiration of the preset delay duration, thereby realizing the global queuing processing of the delayed task message. In summary, this embodiment can take into account the requirements of each task for delayed processing and global queue processing, improve system performance, and avoid message loss.
[0048] In one embodiment, the flow distribution module 302 is specifically configured to: If the preset delay duration is greater than the duration threshold, the first delay service is controlled to send the first delay task message corresponding to the preset delay duration in the message queue to the sequential storage unit; If the preset delay duration is less than or equal to the duration threshold, the first delay service is controlled to send the second delay task message corresponding to the preset delay duration in the message queue to the time wheel.
[0049] In one embodiment, the flow distribution module 302 is specifically configured to: If the currently required delay duration of the first delayed task message decreases from the preset delay duration to the duration threshold, controlling the scheduling service to schedule the first delayed task message in the sequential storage unit to the second delayed service; Control the second delayed service and send the first delayed task message to the time wheel.
[0050] In one embodiment, the expiration message sending module 303 is specifically configured to: When the preset delay time of the target delayed task message in the time round expires, controlling the target delayed service to send the expired target delayed task message to the message queue; The target delayed task message includes the first delayed task message and / or the second delayed task message, and the target delayed service includes the first delayed service and / or the second delayed service.
[0051] In one embodiment, a delayed service closing module (not shown in the figure) is further included, which is used to: Control the target delay service to stop receiving target delay task messages; The target delayed task message includes the first delayed task message and / or the second delayed task message, and the target delayed service includes the first delayed service and / or the second delayed service.
[0052] In one embodiment, a sorting module (not shown in the figure) is further included, which is used to: The sequential storage unit is controlled to sort the first delayed task messages therein according to the currently required delay duration.
[0053] Figure 4 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call a computer program in the memory 430 to execute the steps of the delayed message processing method, for example, including: Control multiple target services and send their respective delayed task messages to the message queue; Diverting the delayed task message based on the preset delay duration of the delayed task message; When the preset delay time of the delayed task message after diversion expires, the expired delayed task message is sent to the message queue, so that the multiple target services can consume the expired delayed task messages respectively.
[0054] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0055] On the other hand, an embodiment of the present application further provides a computer program product, the computer program product including a computer program, the computer program may be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can perform the steps of the delayed message processing method provided in the above embodiments, for example, including: Control multiple target services and send their respective delayed task messages to the message queue; Diverting the delayed task message based on the preset delay duration of the delayed task message; When the preset delay time of the delayed task message after diversion expires, the expired delayed task message is sent to the message queue, so that the multiple target services can consume the expired delayed task messages respectively.
[0056] On the other hand, an embodiment of the present application further provides a non-transitory computer-readable storage medium on which a computer program is stored, wherein the computer program is used to enable a processor to execute the steps of the delayed message processing method provided in the above embodiments, for example, including: Control multiple target services and send their respective delayed task messages to the message queue; Diverting the delayed task message based on the preset delay duration of the delayed task message; When the preset delay time of the delayed task message after diversion expires, the expired delayed task message is sent to the message queue, so that the multiple target services can consume the expired delayed task messages respectively.
[0057] The non-transitory computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)), etc.
[0058] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0059] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0060] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A delayed message processing method, characterized in that: include: Control multiple target services and send their respective delayed task messages to the message queue; Diverting the delayed task message based on the preset delay duration of the delayed task message; When the preset delay time of the delayed task message after diversion expires, the expired delayed task message is sent to the message queue, so that the multiple target services can consume the expired delayed task messages respectively.
2. The delayed message processing method according to claim 1, characterized in that: The step of diverting the delayed task message based on the preset delay duration of the delayed task message includes: If the preset delay duration is greater than the duration threshold, the first delay service is controlled to send the first delay task message corresponding to the preset delay duration in the message queue to the sequential storage unit; If the preset delay duration is less than or equal to the duration threshold, the first delay service is controlled to send the second delay task message corresponding to the preset delay duration in the message queue to the time wheel.
3. The delayed message processing method according to claim 2, characterized in that: After sending the first delayed task message corresponding to the preset delay duration in the message queue to the sequential storage unit, the method includes: If the currently required delay duration of the first delayed task message decreases from the preset delay duration to the duration threshold, controlling the scheduling service to schedule the first delayed task message in the sequential storage unit to the second delayed service; Control the second delayed service and send the first delayed task message to the time wheel.
4. The delayed message processing method according to claim 3, characterized in that: When the preset delay time of the delayed task message after diversion expires, sending the expired delayed task message to the message queue includes: When the preset delay time of the target delayed task message in the time round expires, controlling the target delayed service to send the expired target delayed task message to the message queue; The target delayed task message includes the first delayed task message and / or the second delayed task message, and the target delayed service includes the first delayed service and / or the second delayed service.
5. The delayed message processing method according to claim 3, characterized in that: After sending the expired delayed task message to the message queue, the method includes: Control the target delay service to stop receiving target delay task messages; The target delayed task message includes the first delayed task message and / or the second delayed task message, and the target delayed service includes the first delayed service and / or the second delayed service.
6. The delayed message processing method according to claim 2, characterized in that: After sending the first delayed task message corresponding to the preset delay duration in the message queue to the sequential storage unit, the method further includes: The sequential storage unit is controlled to sort the first delayed task messages therein according to the currently required delay duration.
7. A delayed message processing device, characterized in that: include: The delayed message sending module is used to: control multiple target services and send their respective delayed task messages to the message queue; A diversion module, used to: divert the delayed task message based on the preset delay time of the delayed task message; The expired message sending module is used to: when the preset delay time of the delayed task message after diversion expires, send the expired delayed task message to the message queue, so that the multiple target services can consume their respective expired delayed task messages.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the delayed message processing method according to any one of claims 1 to 6 are implemented.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the delayed message processing method according to any one of claims 1 to 6 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the delayed message processing method according to any one of claims 1 to 6 are implemented.