MD ISLAM
MD ISLAM

Reputation: 81

how to check if queues of the RabbitMQ server is alive

I am totally new to spring framework. I am trying to create a java maven project where I can have the connectivity to the rabbitMq and I even before publish the message, I want to check if the queues are alive or not. Is this possible to ping the queue to see if it a alive or not.. I am totally new to this rabbitMQ. Thanks for the answers

Upvotes: 3

Views: 5744

Answers (1)

Derick Bailey
Derick Bailey

Reputation: 72868

Checking for the availability of a queue is a bit of an anti-pattern with messaging systems.

The message producer should not care if there is something on the other end to receive / process the message. The producer only cares that the RabbitMQ instance is available, with the correct exchange.

If the message must be delivered to a consumer, guaranteed, then the consumer needs to configure the queue with durability in mind and the producer should send the message with the persistence flag to ensure it is written to disk.

...

re-reading your question, i'm wondering if you mean "rabbitmq server" when you say "queue". are you wanting to check if the rabbitmq server is available?

if that is the case, the proper thing to do is use a heartbeat in your RabbitMQ connection. the spring framework should know how to do this, and should respond with some kind of event or other code that executes when the connection dies. i'm not really familiar with spring, though, so i don't know the details of doing that with this framework.

You might check this post or this RabbitMQ page on handling this.

Upvotes: 4

Related Questions