[rabbitmq-discuss] Calling unbind() without calling bind()

Tim Watson tim at rabbitmq.com
Wed Mar 13 09:35:21 GMT 2013


Hi

On 03/13/2013 09:28 AM, PSL 88506 wrote:
>
> When we are calling Channel. queueUnbind() without calling 
> Channel.queueBind(), An exception is thrown.
>
>

This is expected, normal behaviour.

> If this is the expected RabbitMQ behavior, is there any error code or 
> message so that we'll suppress such messages and will not allow to 
> propagate.
>
>

This exception *has* to be thrown, according to the AMQP specification: 
http://www.rabbitmq.com/amqp-0-9-1-reference.html#class.queue - if you 
wish to handle the exception, you may do so, but I'd recommend simply 
enforcing the presence of the binding beforehand, so as to ensure unbind 
does not fail. Bind operations are idempotent in the specification:

"A server MUST allow [and] ignore duplicate bindings - that is, two or 
more bind methods for a specific queue, with identical arguments - 
without treating these as an error. "

>  Please let us know the error code or message which will occur when 
> Channel. queueUnbind() is called without calling Channel. queueBind().
>
>

 From the spec (viz 
http://www.rabbitmq.com/amqp-0-9-1-reference.html#class.queue) the 
relevant bits of unbind are:

1. "If a unbind fails, the server MUST raise a connection exception."
2. "The client MUST either specify a queue name or have previously 
declared a queue on the same channel Error code: not-found"
3. "The client MUST NOT attempt to unbind a queue that does not exist. 
Error code: not-found"
4. "The client MUST NOT attempt to unbind a queue from an exchange that 
does not exist. Error code: not-found"

Cheers,
Tim


More information about the rabbitmq-discuss mailing list