RabbitMQ High chapter nine TTL setting queue or queue a message and the message is valid

TTL message queue and introduction

This article is "RabbitMQ succinctly Series" in Chapter 16.: RabbitMQ messaging middleware succinctly and 16 advanced version of nine TTL queues and messages. If you want to learn RabbitMQ is recommended to see friends from the first chapter begins.

TTL:

    Time To Live TTL is an abbreviation, is the time to live. That RabbitMQ supports message expiration time, when a message can be sent to a specified expiration time;

RabbitMQ supports simultaneous expiration time queue, the message from the queue counted, more than the timeout queue configuration, the message will automatically clear.

This article today, we do not have to write code demonstrates. Use the page configured to send a message.

Log in to the page control units:

Create a queue queue.

Set queue name is: test002

To the arguments set parameters:

x-max-length: The maximum length. We set up 3000

x-message-ttl: setting the timeout duration. We set 10,000 milliseconds, or 10 seconds.

FIG follows:

image1.png

After the setup is complete, we then click Add., You can see in the list of queues, we created test002 queue. As shown below:

image2.png


Next, we create switches exchange:

Set name to: test002_texchange

Set type to type: topic

Set Durability is durable. Persistence

As shown below:

image3.png

After the setup is complete, click Save. We can see test002_exchange just created in the list of exchanges in the switch. As shown below:

image4.png

Then we bind the relationship between the switch and the queue.

Click the queue we've created, add a binding

Select To queue is the last step we create the queue name: test002

Set routing key to ttl. #.

As shown below:

image5.png

After clicking bind, we can see the binding relationship. As shown below:


image6.png

Then we have to send a message.

Click test002-exchange, we can see the Publish message. You can send messages on the page.

image7.png

We set:

You can see properties this property, we need to have a.

image8.png

Setting Routing key: ttl.abcd

Set Delivery mode: 2-persistent. Persistence

Then setup message, Payload.

Setting is completed as shown below:

image9.png

Click publish message:

image10.png

Sent successfully.

We take a look at the queue: test002 already has a message. As shown below:

image11.png

We wait 10 seconds, find the message automatically disappear. as follows:

image12.png

The next section explains: Dead Letter Queue

Kaige public number: Kaige Java (kaigejava)

Guess you like

Origin blog.51cto.com/kaigejava/2426137