Hi,
In Spring-AMQP, please let me know if there are any API methods for the following:
1. To check if a Queue already exists (using queue name).
2. To check if Exchange already exists (using exchange name).
Thanks in Advance..
Sam
Hi,
In Spring-AMQP, please let me know if there are any API methods for the following:
1. To check if a Queue already exists (using queue name).
2. To check if Exchange already exists (using exchange name).
Thanks in Advance..
Sam
RabbitAdmin provides declareQueue and declareExchange methods. Those are idempotent, so even if the Queue or Exchange already exists, it's safe to call those methods. Does that match your use-case, or are you trying to do something different... such as when the Queue does not exist, prevent something?
-Mark
Mark Fisher
Spring Integration Lead
SpringSource, a division of VMware
http://www.springsource.com
http://www.springsource.org/spring-integration
http://blog.springsource.com/main/author/markf
Thanks for ther response Mark.
My requirement is that, I have to delete a queue with the queue name (using amqpAdmin.deleteQueue(queueName) method). So I need to check if there is already a queue existing with that queueName.
Is there any API methods that fulfills this functionality (say like isQueueExists(name), etc...)..
Thanks in Advance
- Sam
RabbitAdmin.delete*() will return false if the Queue/Exchange did not exist, since the broker will raise an exception in that case. If you need more fine grained control there is always the execute() method in RabbitTemplate, and the underlying API (e.g. Channel.queueDeclarePassive).