[rabbitmq-discuss] Exchange consumer declaration

Michael Klishin mklishin at gopivotal.com
Fri Jun 13 00:42:02 BST 2014


On 13 June 2014 at 03:33:09, Larry Lewis (rabbitmq at jenolan.org) wrote:
> > When a LVC consumer is defined it needs to do a 'exchange_declare'  
> but it needs to declare the exchange paramaters which is sub-optimal.  
> A consumer should be able to use just the exchange name to derive  
> the linkage. It should never be creating it (if it aint there that's  
> an error). Why I am concerned is that as I create consumers of exchanges  
> I do not want to be bothered with the settings of the exchange so  
> that the code that creates the exchange is the only one that needs  
> to worry about the attributes.
>  
> Is there a way to acquire/specify the exchange 'read-only',  
> without using the definition options that are in the 'exchange_declare()'  
> method?

The feature you want is called passive declare (set passive = true).
It results in a channel exception if the exchange does not exist and no-op
(success)  if it does.

You can also use exchange name without declaring it first: if you are sure it's
there, simply pass it to queue.bind and similar methods.
--  
MK  

Software Engineer, Pivotal/RabbitMQ


More information about the rabbitmq-discuss mailing list