简体   繁体   中英

How to stop exchanges/queues from receiving messages temporarily?

My deployment is like as shown below:

client -> relay server -> server

The relay server is a rabbitmq service which contains an exchange and many queues which are bound to this exchange. Any message pushed to this exchange with a mapping routing key will push the message to appropriate queue.

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

Please help. Dead message queue didn't work.

I will try to answer your question as i am working with RabbitMQ currently. As far i know there is no way blocking messages to be pushed to queue. You have to achieve this programatically.

Step 1: Poll server for its running status before you want to push message to queue.

Step 2: If server is running go ahead pushing message to queue if not you know what you want to do.

Hope it helps you.

server can create queues with the x-expires set which means:

How long a queue can be unused for before it is automatically deleted (milliseconds).

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

See the documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM