[rabbitmq-discuss] How to get list of declared exchanges and queues in rabbitmq using Java?

Simon MacMullen simon at rabbitmq.com
Fri May 9 11:38:14 BST 2014


On 08/05/14 20:11, ankit2186 wrote:
> For some reason I have to create queue through shell script command as well
> as same queue through Java code too.
>
> For shell script I am trying to create with management plugin:
> rabbitmqadmin declare queue name="FOO" durable=true auto_delete=false
> `arguments={"x-message-ttl":86400000}`
>
> which gives not error in rabbit at host.log

It will give an error if the queue already exists without the TTL 
argument...

> =ERROR REPORT==== 8-May-2014::18:54:22 ===
> connection <0.308.0>, channel 1 - error:
> {amqp_error,precondition_failed,
>              "inequivalent arg 'x-message-ttl'for queue 'FOO' in vhost '/':
> received the value '86400000' of type 'signedint' but current is none",
>              'queue.declare'}

...which is what's happening here. This is not management vs Java, this 
is whether the queue already exists with different arguments.

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list