Fix of reconnect() method + 'passive' queues. #170
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I am using node-amqp through a proxy and I figured out two issues. The issues are due to the timeout of the proxy, which closes the connection.
The first issue is about the
reconnect()
method: When the proxy closes the connection, I receive a 'close' event. I wanted to reconnect manually using thereconnect()
method (otherwise I need to wait until an error occurs to fall in thebackoff()
method), but in this method, the queues' subscriptions are not marked as closed, unlike in thebackoff()
method.Thus, the queues will never resubscribe once we are reconnected.
The second issue is about the passive queues. Before sending a message, I want to declare a 'passive' queue, in order to check if it exists and if it has consumers.
But by doing that, we have two issues:
Connection.queues
array. Then, if we reconnect, the active queue will not be able to resubscribe as amqp does not have any reference on itsconsumerTagListeners
anymore.The attached patch has resolved these issues in my env, but my amqp knowledge is not huge so I'd like you to have a look and tell me if it seems good to you.
Thanks.