[rabbitmq-discuss] know when a consumer disconnect from a node

759 views
Skip to first unread message

Kilian C.

unread,
Nov 14, 2011, 1:39:06 PM11/14/11
to rabbitmq...@lists.rabbitmq.com
Hi to all,
is it possible to know when a client is disconnected from a rabbitmq node?

This is my env:

1 rabbitmq node.
3 client (publishers/subscribers) severs

when a server crashes/shutdown/disconnects from the rabbitmq server, other client server needs to be notified about that.

Is there a way to route/publish a simple (dis)connection message to a certain queue/exchange?

-- 
Kilian C.

Matthias Radestock

unread,
Nov 14, 2011, 1:59:26 PM11/14/11
to Kilian C., rabbitmq...@lists.rabbitmq.com
Kilian,

There is nothing built-in, but you could implement a custom exchange
type for this.

The basic idea is that a client, after connecting, creates an exclusive
queue and binds it to an exchange of the custom exchange type. Due to
the exclusivity, the queue and hence the binding will get removed when
the connection is closed. The exchange sees both the bind and unbind
events and can publish notification messages when it gets them.

See https://github.com/tonyg/presence-exchange for an exchange type that
does s.t. like that. Warning: this may need some tweaking to get to work
with recent versions of RabbitMQ.


Regards,

Matthias.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Kilian C.

unread,
Nov 14, 2011, 7:26:43 PM11/14/11
to Matthias Radestock, rabbitmq...@lists.rabbitmq.com
actually i am using https://github.com/postwait/node-amqp (nodejs)
the only way is to write a custom exchange? the topic exchange doesn't have the bind/unbind event?

i am not so good at erlang :)

-- 
Kilian C.

Matthias Radestock

unread,
Nov 14, 2011, 7:37:50 PM11/14/11
to Kilian C., rabbitmq...@lists.rabbitmq.com
Kilian,

On 15/11/11 00:26, Kilian C. wrote:
> actually i am using https://github.com/postwait/node-amqp (nodejs)
> the only way is to write a custom exchange? the topic exchange doesn't
> have the bind/unbind event?
>
> i am not so good at erlang :)

You could implement everything via an external exchange without needing
to touch Erlang: https://github.com/rabbitmq/rabbitmq-external-exchange.

Marek Majkowski

unread,
Nov 14, 2011, 7:44:36 PM11/14/11
to Matthias Radestock, rabbitmq...@lists.rabbitmq.com, Kilian C.
On Mon, Nov 14, 2011 at 18:59, Matthias Radestock <matt...@rabbitmq.com> wrote:
> See https://github.com/tonyg/presence-exchange for an exchange type that
> does s.t. like that. Warning: this may need some tweaking to get to work
> with recent versions of RabbitMQ.

Just a brief note, I got it working few months ago:
https://github.com/majek/rabbitmq-x-presence

Again, things might have changed since then and the code may
require some minor changes, but at least it should be easier to
get it working.

Cheers,
Marek

Simon MacMullen

unread,
Nov 15, 2011, 6:36:33 AM11/15/11
to rabbitmq...@lists.rabbitmq.com
On 15/11/11 00:44, Marek Majkowski wrote:
> Again, things might have changed since then and the code may
> require some minor changes, but at least it should be easier to
> get it working.

This postdates the serialise_events change so it should be as good as it
ever was.

I wonder about importing this into public-umbrella. Hmm.

Cheers, Simon

--
Simon MacMullen
RabbitMQ, VMware

Reply all
Reply to author
Forward
0 new messages