Consumer Cancel Notifications

54 views
Skip to first unread message

bslvr

unread,
May 16, 2012, 3:17:00 AM5/16/12
to ruby...@googlegroups.com
Moving this conversation to the mailing list.

My original question:

I'm looking for this functionality: http://www.rabbitmq.com/extensions.html#consumer-cancel-notify

To solve this problem:

http://stackoverflow.com/questions/10443477/unsubscribe-from-rabbit-queue-when-machine-is-shut-down/10488209#10488209

Is this possible with Ruby-amqp gem?

Response:

No, although it is one of the simplest extensions to add. Please use mailing list to ask questions.

Question:

In this case, how can we add this extension? Should I submit a ticket on github? Is this likely to be implemented? Is there a workaround in the meantime based off of my stackoverflow post?

Michael Klishin

unread,
May 16, 2012, 3:34:13 AM5/16/12
to ruby...@googlegroups.com

El 16/mag/2012, a las 11:17, bslvr escribió:

> In this case, how can we add this extension?

There are three steps to adding an extension like this:

1. Add AMQP method (operation) serialization. That should be already covered by amq-protocol.
2. Add a handler for it like here:

https://github.com/ruby-amqp/amq-client/blob/master/lib/amq/client/async/queue.rb#L497-555
https://github.com/ruby-amqp/amq-client/blob/master/lib/amq/client/async/consumer.rb#L222-249

3. Expose a method on AMQ::Client::Consumer and possibly AMQ::Client::Queue that will register a callback for
cancellation notifications, like here:

https://github.com/ruby-amqp/amq-client/blob/master/lib/amq/client/async/consumer.rb#L100

I wouldn't be surprised if it all clocks at about 15 lines of code or so.

> Should I submit a ticket on github?

Yes but see my thoughts at the end of this email.

> Is this likely to be implemented?

Yes.

> Is there a workaround in the meantime based off of my stackoverflow post?

So rebooting a machine does not cause consumers registered by processes on that machine to be removed? This is very strange. Are you using management UI to verify this?

I am afraid this is a RabbitMQ issue (because it's ultimately up to the broker to prune consumers when their
channels are closed) and Consumer Cancellation Notification extension won't solve this. CCN is created for cases
when a consumer is cancelled using either management UI or because its queue was deleted, so an application
that registered it needs to be notified about this.

MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

Reply all
Reply to author
Forward
0 new messages