[rabbitmq-discuss] Question about Queue Bind/Unbind
Alvaro Videla
videlalvaro at gmail.com
Fri Apr 9 05:59:23 BST 2010
Hi Tony,
Oh, OK.
So basically to stop receiving the other notifications I will have to unbind the queue from the unwanted binding and then just keep one binding, right?
Thanks for clarifying this.
Alvaro
On Apr 9, 2010, at 12:56 PM, Tony Garnock-Jones wrote:
> Hi Alvaro,
>
> Alvaro Videla wrote:
>> So far so good, but when I stop the app and then I say that the queue
>> "usa" must be bound by the "usa.weather" routing key, nothing
>> happens. the binding is not changed.
>>
>> Then I read the code of rabbit_exchange:add_binding/4 and it seems
>> that it doesn't support overwriting the binding.
>
> Queue.bind won't alter a binding, but it will add a new binding. It's
> also idempotent, so two or more queue.binds with identical arguments
> will act the same as just one.
>
> So the following:
>
> - queue.declare('usa')
> - queue.bind(binding_key = 'usa.news', queue = 'usa')
> - queue.bind(binding_key = 'usa.weather', queue = 'usa')
>
> will (should!) result in *two* bindings. The queue should then receive
> messages published to the exchange with either usa.news or usa.weather.
>
> You could also use 'usa.*', if you like, to pick up all USAish messages
> with a single binding.
>
> Tony
More information about the rabbitmq-discuss
mailing list