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

ankit2186 ankit2186 at gmail.com
Thu May 8 20:11:28 BST 2014


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

but when I create same queue with parameters in java:
Map<String, Object> args = new HashMap<String, Object>();
args.put("x-message-ttl", new Integer (messageTTL.intValue() *1000));
Ch.queueDeclare(FOO, true, false, false, args);

I am getting error in rabbit at host.log
=INFO REPORT==== 8-May-2014::18:54:22 ===
accepting AMQP connection <0.308.0> (10.3.14.107:41306 -> 10.3.14.107:5672)

=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'}

and java code throws: 
ERROR : AMQPManager - clean connection shutdown; reason: Attempt to use
closed channel
ERROR : AMQPManager - Exception occurred while publishing event
UnknownException: com.rabbitmq.client.AlreadyClosedException: clean
connection shutdown; reason: Attempt to use closed channel
       




--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/How-to-get-list-of-declared-exchanges-and-queues-in-rabbitmq-using-Java-tp35352p35430.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list