Method and tool for processing delay task based on RabbitMQ
A technology for processing delays and tasks, applied in digital transmission systems, data exchange networks, electrical components, etc., can solve problems such as resource consumption
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0044] combined with figure 1 , this embodiment proposes a method for implementing task delay based on RabbitMQ, the method includes:
[0045] Step S1, based on RabbitMQ, set the validity period TTL of the message. Set the message validity period TTL, that is, set the survival time of the message, which involves the survival time of the queue and the survival time of the message itself;
[0046] (a) If the survival time of the message itself is greater than the survival time of the queue where the message is located, then the survival time of the message itself depends on the survival time of the queue where it is located,
[0047] (b) If the survival time of the message itself is less than the survival time of the queue where the message is located, then the message becomes a dead letter after reaching its own survival time.
[0048] For case (b), set the validity period TTL of the message by adding the parameter attribute of expiration in the basic.publish method, the unit i...
Embodiment 2
[0062] Reference attached figure 1 , this embodiment proposes a tool for implementing task delay based on RabbitMQ, a message declaration module and a message consumption module.
[0063] The message declaration module is based on RabbitMQ, sets the message validity period TTL, configures the dead letter exchange DLX, and creates a dead letter queue based on the routing keyword routingKey to realize the binding of the dead letter exchange DLX and the private message queue. The message consumption module adopts the strategy mode, defines the strategy interface, and implements the processing method of the strategy interface to consume messages when using it. It uses the applicationContext that comes with Spring. When using it, the processing class is corresponding to the automatically injected processing class according to the preset name, and the corresponding The processing class consumes the message.
[0064] For messages that fail to be processed by consumers in the delay q...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 
