-
Notifications
You must be signed in to change notification settings - Fork 475
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
Set a custom header before nack-ing a message #735
Comments
Hi @dimisus, Unfortunately there is no good way to do this with Rascal (a wrapper for amqp) has the option of republishing the message back to the original queue after copying the headers and adding a failure reason. It also adds a special header instructing Rascal to immediately nack the message on redelivery rather than attempting to process it. You could do something similar, but it still feels hacky and creates the potential for a duplicate message since the original message is not acknowledged/discarded before the mutated one is republished. |
Hi. Thank you for the quick reply. Pity... |
You can enable transaction on the channel, and then republish the message and ack the original message in a single transaction. |
Beg you pardon, but not it is not obvious how to: https://amqp-node.github.io/amqplib/channel_api.html I am thinking about republishing the message using the delayed message plugin to force it for another full cycle. |
Unfortunately transactions aren't supported with amqplib. There's a discussion here. |
If the above does not help, please provide as much of the following information as is relevant...
I desperately want to set a header for a message that is going to be nack'ed. But apparently it is impossible to set a custom header on a message since nack only uses a reference to a message. Is there any work around or any possibility I am not able to find?
What I want to achieve is to set a hint of a reason why the message was nack'ed as a custom header. Which would make debugging and processing of nack'ed message in production much easier and one can react to issues faster.
If I go the hacky way and publish the messages directly to the DLX I may lose a lot of built-in functionality such as the x-death headers etc.
The text was updated successfully, but these errors were encountered: