Unlock instant, AI-driven research and patent intelligence for your innovation.

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

Pending Publication Date: 2021-10-22
SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF2 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

There is no big problem when the amount of data is small, but the way of training the database with a large amount of data will become particularly resource-intensive

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and tool for processing delay task based on RabbitMQ

Examples

Experimental program
Comparison scheme
Effect test

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...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for processing a delay task based on RabbitMQ, and relates to the technical field of message processing, and the method comprises the steps: setting a message validity period TTL based on RabbitMQ; configuring a dead letter switch DLX based on RabbitMQ, and creating a dead letter queue based on a routing key word routingKey to realize the binding of the dead letter switch DLX and the dead letter queue; for the dead letter queue, selecting a consumer for a message by using a policy mode; when a message which fails to be processed by a consumer is sent to a delay queue through a delay switch,automatically forwarding the message to the dead letter queue matched with a routing key carried by the message through the dead letter switch DLX after the delay queue expires, and then selecting the consumer for the message of the dead letter queue by using a policy mode, so that timely processing of the delay message is realized. The invention further discloses a tool for processing the delay task based on RabbitMQ. The method is achieved through a message declaration module and a message consumption module.

Description

technical field [0001] The invention relates to the technical field of message processing, in particular to a method and tool for processing delayed tasks based on RabbitMQ. Background technique [0002] In daily development, several scenarios are often encountered. The IoT system often issues commands to the terminal. If the command is not answered for a period of time, it needs to be set to timeout. 30 minutes after the order is placed, if the user does not pay, the system will automatically cancel the order. The above-mentioned similar needs are problems we often encounter. The most common method is to periodically rotate the database and set the state. There is no big problem when the amount of data is small, but the method of round-robin training the database with a large amount of data will become particularly resource-intensive. When faced with tens of millions or hundreds of millions of data volumes, the IO written by itself is relatively high, resulting in long-te...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): H04L12/705H04L12/875H04L45/18H04L47/56
CPCH04L45/20H04L47/56
Inventor 徐士强魏金雷杨继伟
Owner SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD