[rabbitmq-discuss] Re-declaring named exchange with passive argument set to true

Michael Bridgen mikeb at lshift.net
Thu Nov 26 11:14:29 GMT 2009


Hi Chris,

> Someone recently asked me a question about finding a named exchange 
> without specifying the type in the declare method call. I've done some 
> testing against RabbitMQ v1.7.0 and it seems that you cannot re-declare 
> an existing exchange without supplying a type argument, even if the 
> passive argument is used and set to true. I consistently get a 503 error.

RabbitMQ implements AMQP 0-8 right now, which doesn't specify passive in 
quite the same way as 0-9-1.  In 0-8, only auto-delete and durable are 
ignored.

> The 0-9-1 AMQP XML spec suggests that if you set the passive argument to 
> true in the exchange declare method call, then type should be ignored.

Yes indeed; 0-9-1 is much clearer than 0-8 on what the passive flag 
means.  Essentially exchange.declare and queue.declare, with passive 
set, are different methods.

> Firstly, can anyone confirm that the behaviour I am observing regarding 
> arguments passed in the exchange declare method is correct. There could 
> be a problem with my client library that I haven't found.

If "without supplying a type argument" above means you send an empty 
string, you're getting back 503 Command Invalid because of AMQP 0-8 rule 
amqp_exchange_18, which says the server must send 503 if it doesn't 
support the exchange type.

If you know the exchange type you should be able to send that and get a 
declare-ok or 404 back.

> Secondly, if the type argument is mandatory even when the passive 
> argument is used and set to true, is this a bug in RabbitMQ?

Not at the minute.  We are working on 0-9-1 support, in the (fairly 
stable and up to date) branch amqp_0_9_1.  In this branch right now, 
Queue.Declare has the new semantics, though Exchange.Declare doesn't 
quite yet.

The client APIs are also being changed; e.g., in the Java client, 
there's now Channel.declarePassive(String name), and Channel.declare no 
longer takes an argument for passive.


Cheers,
Michael





More information about the rabbitmq-discuss mailing list