-
Notifications
You must be signed in to change notification settings - Fork 137
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
How to properly handle errors on consumers? #218
Comments
Consumers should handle their exceptions. I'm not sure if this answers your question but there isn't much Hutch-specific. If you need to inspect protocol method flow or message flow, use Wireshark and RabbitMQ tracing, respectively. |
@michaelklishin Thanks for reply. My issue was not related to protocol itself, but the aspect of handling the errors without stopping worker. |
Then perhaps I don't understand the question. Consumers are generally supposed to handle exceptions they can do something about. |
I am also wondering how to best address this. If there is a syntax error in my code, I want the job to go back into the queue. Consider this flow:
How would we handle this logic so failed jobs aren't lost forever? |
#177 introduced configurable acknowledgement behavior. |
My current setup is:
hutch.yml (configuration):
Command:
hutch --config config/hutch.yaml
I have a consumer executing a process that could raise some errors:
Hunting down the issue, I:
@broker.ack
onHutch::Worker#handle_message
, sending anrequeue
andack
messages to RabbitMQ, broking the protocol.hutch shut down gracefully
in the middle of processing.Considering #165, acking manually seems to be the best option, taking into account that as said in #195, the library could not decided whether if the worker/consumer should crashes due an unhandled exception.
This issue is more a doubt about what is the correct way to handle the errors on consumers?
The text was updated successfully, but these errors were encountered: