How can I temporarily stop the exchange / queues from receiving messages?

My deployment looks like below:

client -> relay server -> server

Relay server is a rabbitmq service that contains an exchange and many queues associated with that exchange. Any message pressed on this exchange using the display routing key pushes the message to the appropriate queue.

Now my requirement is: when the server is down, I should avoid / block the "relay server" from accepting any additional messages.

Please, help. The dead message queue was not working.

+3


source to share


2 answers


I will try to answer your question as I am currently working with RabbitMQ. As far as I know, there is no way to block messages from being sent to the queue. You must achieve this programmatically.

Step 1: poll server for its running status before you want to send a message to the queue.



Step 2: If the server is running, keep pushing the message to the queue if you don't know what you want.

Hope this helps you.

+2


source


server

can create queues with a set x-expires

, which means:

How long a queue can be used before it is automatically deleted (Milliseconds).



Thus, if the server is down, the associated queue will be removed and no messages will be queued.

See documentation

0


source







All Articles