postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

Reconnect logic fails to handle auto-delete queues #190

Closed humanchimp closed 11 years ago

humanchimp commented 11 years ago

ISTM that the auto-reconnect logic only works when dealing with queues that are autoDelete:false. I am still investigating this, but I believe it has to do with the old bindings not being replayed against the newly-redeclared exchanges and queues. This also affects exclusive:true queues, which are implicitly autoDelete:true. So basically, it almost works, but then messages just get /dev/nulled since the new exchanges have no bindings.

I'll follow up with a pull request if I can figure this out.

Edit: looks like that's right, the bindings aren't getting replayed: http://d.pr/i/4yjc

Edit: it seems obvious that any messages from before the disconnect will be lost when we are dealing with exclusive queues. There is no practical solution to that, so any solution to this will necessitate different semantics than the current reconnection logic. I'm not convinced that it's wise to replay a topology like this, but alternatives are worse.

humanchimp commented 11 years ago

I've tentatively decided that this is not going to be practical. Within the library, I am not in a position to make assumptions about the application, and once I start replaying queue bindings, then events start firing, which may lead to double listeners being added, and broken behavior. Closing.