Delay message/queue of RabbitMQ advanced features

  Click " JavaEdge " above and follow the official account

Set as " star ", don't miss good articles!

RabbitMQ itself does not have a delay queue function, and it is impossible to directly specify a queue type as a delay queue and then delay processing. There are two implementation schemes: plug-in and function collocation.

Only the second is introduced here. You can combine TTL+DLX to form a delay queue.

Case

If no payment is made within 20 minutes after the order is placed, the order will be closed. If RabbitMQ is used, TTL+DLX must be combined.

solution

First set the order message to a 15-minute TTL, and when the time expires, the queue will forward the message to DLX, and then distribute the message to the bound queue we configured, and then define the consumer to consume the message in this queue, and the delay is achieved. It takes 15 minutes to consume.

At present, there are  800+ people in the exchange group , aiming to promote technical exchanges. You can follow the official account and add the author WeChat to invite you to join the group.

I like the article, click on the " viewing, like, and share " quality to support it~

Guess you like

Origin blog.csdn.net/qq_33589510/article/details/109712933