Revival of #9620 Pass the message to rabbit_backing_queue:discard
callback
#12743
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.
Proposed Changes
This is a refresher of PR #9620. It was requested to come back with these changes after HA/Mirroring queues were deprecated.
Here I include the previous PR description:
The
rabbit_backing_queue:discard
callback is passing the message ID to the implementer. This is often not enough to carry on some necessary work as it's seen in the rabbit_priority_queue comment.In my particular case, this makes it hard to fix the following issue:
noxdafox/rabbitmq-message-deduplication#96
In the above issue a consumer starts consuming with noAck over an empty queue. A publisher publishes a single message which gets forwarded directly to the consumer. In this case, the discard callback is invoked instead of publish_delivered and therefore it's header is not removed from the deduplication cache.
Problem is the discard callback only forwards the message ID and not the whole message not providing enough context for the implementer.
This patch adjust the rabbit_backing_queue behaviour passing the whole message to the discard callback instead of its sole ID.
Types of Changes
What types of changes does your code introduce to this project?
Checklist
CONTRIBUTING.md
document