Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass autoDelete option to SubSocket #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Kines
Copy link

@Kines Kines commented Sep 29, 2014

I use rabbit.js with socket.io this way: when connection (between browser and nodejs) open it creates it's own unique SubSocket so backend can publish messages directly client.
If flag autoDelete set to false rabbitMq keeps all of this unique (and already useless) exchanges after socket.io closes connection and it's count grow to hundreds, that is at least annoying.

@squaremo
Copy link
Owner

Yes, garbage-collecting exchanges is a pain. I haven't come up with a good solution -- it's a gap in AMQP, really.

The flaw in this change is that it only takes into account subscribers -- when the last subscriber goes, the exchange will be deleted, and any publishers to that exchange will get an error and crash.

See #49 re garbage collection in general.

@squaremo
Copy link
Owner

The flaw in this change is that it only takes into account subscribers

To explain the problem a bit more: if an exchange is marked as auto-delete, once no queues are bound to it, it will be deleted. In rabbit.js, queues are owned by subscribers, so in effect what you get is that once there are no subscribers, there are no queues, and once there are no queues, the exchange is deleted.

However, there's no analogue to those queues for publishers, so there's no way (that I've come up with) for a publisher to prevent an auto-delete exchange from being deleted. Without that, while this might help keep things tidy, it also causes problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants