#ack
following #requeue
causes exit
#168
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.
I have a hutch worker similar to the following:
This causes the process to shut down gracefully. Apparently, the
requeue!
sends off a@channel.reject(delivery_tag, true)
and then exits theConsumer
process method. Within theWorker#handle_message
method, it then callsbroker.ack(delivery_info.delivery_tag)
. After this point the channel is closed, which seems to indicate that rabbitmq drops the connection when an ack follows a reject.I created a test to show that ack is called after a reject.
We need some way to prevent this. A couple of ideas:
Add a property to
Hutch::Message
that indicates if there was already some ack/nack/reject action taken on the message within the process method. If so, do not attempt ack/nack fromWorker#handle_message
.Remove the nack from the rescue block of
Worker#handle_message
. Instead, rely on a defaultErrorHandler
to do the nack and allow users to specify their own error handler that could examine the error and decide wither to nack/reject/requeue. This might have to cause a breaking change for anyone who manually setsHutch::Config.set :error_handlers, [..]