[rabbitmq-discuss] Garbage collection of queues and exchanges

Michael Bridgen mikeb at squaremobius.net
Tue Mar 4 14:47:44 GMT 2014

In the Node.JS module rabbit.js[1], the main abstractions are various
kinds of socket (which are Node.JS streams[2]) that publish or
(sometimes and) consume to and from exchanges and queues hosted in
RabbitMQ. The sockets, like AMQP connections, are expected to be
fairly long-lived, and more so the server objects to which they refer,
since they may be mentioned by a number of sockets with overlapping

For example, a socket might connect to "events", which implicitly
creates an exchange called "events", and sends everything written to
the socket, to that exchange. Simple stuff. Here is the snag: when
there are no longer sockets connected to "events", I want the exchange
"events" to go away.

If those sockets are consuming from private queues bound to "events",
I can make those queues exclusive, or mark them as auto-delete, or
give them a TTL. But if a socket is *publishing* to "events", there's
no relationship between the socket and the exchange, so there's
nothing that happens to signal that the exchange is no longer being
used. This applies equally to sending to queues, and in fact in the
case of sending to queues, rules out the use of auto-delete etc for
consumers of those queues.

I would think this is a problem with AMQP in general. I wonder, aloud
in a public forum, if there are any tactics people have come up with
to get around it.


[1] https://github.com/squaremo/rabbit.js
[2] http://nodejs.org/api/stream.html

More information about the rabbitmq-discuss mailing list