[rabbitmq-discuss] Unbinding when not bound

Emile Joubert emile at rabbitmq.com
Thu May 6 15:24:39 BST 2010


Hi Roaan,

If you are concerned about receiving messages asynchronously between 
binding and unbinding the queue then you could cancel the subscription 
first. Be aware that messages may still end up in the queue, even if 
they are not delivered. It would of course be preferable to avoid the 
entire sequence (cancel subscription, bind, unbind) if there was no 
binding in the first place.

Another approach is to allow the exception to occur and recover from it 
by re-establishing the connection.


-Emile




Roaan Vos wrote:
> Hi,
> 
> On second thought, I don't think that will work.
> 
> If I first do the binding, the client will likely receive data he didn't 
> intend before being able to remove the binding.
> 
> Since consuming messages off of the queue is happening asynchronously, 
> while the bind/unbind happens on a different connection I think the 
> above is quite possible.
> 
> Thanks
> 
> Roaan
> 
> 
> On 6 May 2010 13:20, Emile Joubert <emile at rabbitmq.com 
> <mailto:emile at rabbitmq.com>> wrote:
> 
> 
>     Hi Roaan,
> 
>     The broker is required to raise a connection exception if an unbind
>     fails, so you are describing expected behaviour.
> 
>     Duplicate bindings will be ignored, so you can prevent the exception
>     by performing a (possibly duplicate) binding immediately prior to
>     unbind.
> 
>     The client is expected to keep track of bindings under normal
>     circumstances though. I assume this is impossible in your case - can
>     you explain why?
> 
>     -Emile
> 
>     Roaan Vos wrote:
> 
>         Hi,
> 
>          
>         I currently allow clients to “bind” and “unbind” to various
>         topics as needed using the .net client.
> 
>         However, when the client “unbinds” without first having done a
>         bind, RabbitMQ throws an exception and the connection seems to
>         disappear.
> 
>         Is there a way for it to keep the connection (or not throw an
>         exception)?
> 
>          
>         Thanks
> 
>          
>         Roaan
> 
> 
>         ------------------------------------------------------------------------
> 
>         _______________________________________________
>         rabbitmq-discuss mailing list
>         rabbitmq-discuss at lists.rabbitmq.com
>         <mailto:rabbitmq-discuss at lists.rabbitmq.com>
>         http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



More information about the rabbitmq-discuss mailing list