Replies: 2 comments
-
Not a bug sorry. That is expected behaviour. If you want to track your own
republishes use your own header key and add this to x-delivery-count.
Cheers.
Karl
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
michaelklishin
-
This is not a bug. If you publisher a copy of a message, to RabbitMQ this is a brand new message. RabbitMQ does not identify messages by their content or properties in any way (with the exception of the message deduplication plugin I guess). RabbitMQ will initialize certain message properties that it controls for all new messages. Setting them in your own code therefore is prohibited but you can use a different header that your applications update as you see fit. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
I am testing the functionality of the
quorum
queue that was released in 2023 (a new feature), and I was checking the behavior of thex-delivery-count
header.I have confirmed in my testing that this value behaves as expected in cases where the consumer process is aborted before acknowledging the message.
However, as a developer was expecting that this flag would not reset in case that I republish a copy of the message after
act
the message (and I have to do it to update message properties)So given that a consumer got a message with
x-delivery-count
= 3 (for example), and the consumer need to "update" (that is: republish and act the original message) some custom property under the header, then in this case, you may expect that the copy of the message will includex-delivery-count
=3
(because this header was also copied), but it was not the case. Its value of it was0
It looks like a bug to me.
Reproduction steps
Send a message using code:
Receive message using code:
After it printed

Nothing done with message: message 1
, press Enter to abort the process.At this point, after the process was aborted, run it again with break point on
Console.WriteLine($"Nothing done with message: {message}");
You will see
This is the expected behavior
Exit the process.
Console.WriteLine($"Nothing done with message: {message}");
with:While executing it, the counter is
2
as expectedBut from this point we are going to delete the original message, and copy all the existing headers that includes

x-delivery-count
=2
and my custom header:We copy this object as it is by resubmit the message with that object:
After this line executed, we want to simulate a case that the process crashed.
So just kill this app
Work
methodThe issue is that the value of

x-delivery-count
is1
but we expect it to be 3 since when we created the message, the value was2
and I was expecting rabbit-mq to add 1 to 2 so I get here 3.Expected behavior
The issue is that the value of
x-delivery-count
is1
but we expect it to be 3 since when we created the message, the value was2
and I was expecting rabbit-mq to add 1 to 2 so I get here 3.Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions