Repository navigation
Apply afterReceivePostProcessors to batch and plain listeners - #3790
Merged
artembilan merged 2 commits intoOct 28, 2026
Merged
artembilan merged 2 commits into
artembilan merged 2 commits into
Conversation
artembilan
requested changes
Oct 28, 2026
| * | ||
| * @since 4.2 | ||
| */ | ||
| public class RabbitAmqpListenerContainerPostProcessorTests { |
Member
There was a problem hiding this comment.
Right.
Same here.
Stop "mocking", please.
Try real broker tests first.
artembilan
requested changes
Oct 28, 2026
artembilan
left a comment
Member
There was a problem hiding this comment.
Please, rebase and resolve conflicts:
This branch has conflicts that must be resolved
Use the [web editor](https://github.com/spring-projects/spring-amqp/pull/3790/conflicts) or the command line to resolve conflicts before continuing.
spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java
`RabbitAmqpListenerContainer` only hands its `afterReceivePostProcessors` to a `RabbitAmqpMessageListenerAdapter`, which applies them for single messages. Batch listeners and any other `MessageListener` receive the messages unprocessed, although the Javadoc promises the processors run after every reception. * Apply the processors in the container for the plain listener path and for each message of a batch * Add `RabbitAmqpListenerContainerPostProcessorTests` for both paths Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
Replace the mock-based test with `RabbitAmqpListenerTests` cases that consume a plain message and a batch from a real broker and check the header set by an `afterReceivePostProcessors` entry. Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
sharanggupta
force-pushed
the
amqp-listener-post-processors-all-paths
branch
from
October 28, 2026 19:29
78200e1 to
43aee1b
Compare
artembilan
enabled auto-merge (squash)
October 28, 2026 19:32
artembilan
disabled auto-merge
October 28, 2026 20:11
spring-builds
pushed a commit
that referenced
this pull request
Oct 28, 2026
Fixes: #3790 `RabbitAmqpListenerContainer` only hands its `afterReceivePostProcessors` to a `RabbitAmqpMessageListenerAdapter`, which applies them for single messages. Batch listeners and any other `MessageListener` receive the messages unprocessed, although the Javadoc promises the processors run after every reception. * Apply the processors in the container for the plain listener path and for each message of a batch * Add `RabbitAmqpListenerContainerPostProcessorTests` for both paths * Test the post processors against a real broker Replace the mock-based test with `RabbitAmqpListenerTests` cases that consume a plain message and a batch from a real broker and check the header set by an `afterReceivePostProcessors` entry. Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev> (cherry picked from commit 090135d)
artembilan
pushed a commit
that referenced
this pull request
Oct 28, 2026
Fixes: #3790 `RabbitAmqpListenerContainer` only hands its `afterReceivePostProcessors` to a `RabbitAmqpMessageListenerAdapter`, which applies them for single messages. Batch listeners and any other `MessageListener` receive the messages unprocessed, although the Javadoc promises the processors run after every reception. * Apply the processors in the container for the plain listener path and for each message of a batch * Add `RabbitAmqpListenerContainerPostProcessorTests` for both paths * Test the post processors against a real broker Replace the mock-based test with `RabbitAmqpListenerTests` cases that consume a plain message and a batch from a real broker and check the header set by an `afterReceivePostProcessors` entry. Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev> (cherry picked from commit 090135d) # Conflicts: # spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
RabbitAmqpListenerContainer.setAfterReceivePostProcessors()promises the processors run after every reception, but the container only passes them to aRabbitAmqpMessageListenerAdapter, which applies them on its single-message path. A batch@RabbitListenerand any otherMessageListenerget the messages unprocessed, so for example a decompressing processor is skipped. This applies the processors in the container for the plain listener path and for each message of a batch; the adapter's own single-message handling is unchanged.