Repository navigation
Honor the listener error handler for synchronous AMQP 1.0 failures - #3786
Merged
artembilan merged 2 commits intoOct 28, 2026
Merged
artembilan merged 2 commits into
artembilan merged 2 commits into
Conversation
`RabbitAmqpMessageListenerAdapter.onAmqpMessage()` wraps any listener exception and throws it, so the `RabbitListenerErrorHandler` and the `returnExceptions` option of a `@RabbitListener` are only honored for `Future`/`Mono` failures, where `asyncFailure()` delegates to `handleException()`. * Delegate synchronous failures to `handleException()` as `onMessage()` does, rethrowing a `ReplyFailureException` unchanged * Add `RabbitAmqpMessageListenerAdapterTests` covering the error handler invocation, the acknowledgment on a null result and a rethrown error Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
artembilan
requested changes
Oct 28, 2026
Signed-off-by: Artem Bilan <artem.bilan@broadcom.com>
artembilan
enabled auto-merge (squash)
October 28, 2026 18:23
spring-builds
pushed a commit
that referenced
this pull request
Oct 28, 2026
Fixes: #3786 `RabbitAmqpMessageListenerAdapter.onAmqpMessage()` wraps any listener exception and throws it, so the `RabbitListenerErrorHandler` and the `returnExceptions` option of a `@RabbitListener` are only honored for `Future`/`Mono` failures, where `asyncFailure()` delegates to `handleException()`. * Delegate synchronous failures to `handleException()` as `onMessage()` does, rethrowing a `ReplyFailureException` unchanged * Add `RabbitAmqpMessageListenerAdapterTests` covering the error handler invocation, the acknowledgment on a null result and a rethrown error * Fix `@since` to `4.0.7` in the `RabbitAmqpMessageListenerAdapterTests` Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev> Co-authored-by: Artem Bilan <artem.bilan@broadcom.com> (cherry picked from commit 695a7ee)
artembilan
pushed a commit
that referenced
this pull request
Oct 28, 2026
Fixes: #3786 `RabbitAmqpMessageListenerAdapter.onAmqpMessage()` wraps any listener exception and throws it, so the `RabbitListenerErrorHandler` and the `returnExceptions` option of a `@RabbitListener` are only honored for `Future`/`Mono` failures, where `asyncFailure()` delegates to `handleException()`. * Delegate synchronous failures to `handleException()` as `onMessage()` does, rethrowing a `ReplyFailureException` unchanged * Add `RabbitAmqpMessageListenerAdapterTests` covering the error handler invocation, the acknowledgment on a null result and a rethrown error * Fix `@since` to `4.0.7` in the `RabbitAmqpMessageListenerAdapterTests` Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev> Co-authored-by: Artem Bilan <artem.bilan@broadcom.com> (cherry picked from commit 695a7ee) # Conflicts: # spring-rabbitmq-client/src/main/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpMessageListenerAdapter.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.
RabbitAmqpMessageListenerAdapter.onAmqpMessage()wraps a listener exception in aListenerExecutionFailedExceptionand throws it without callinghandleException(), so a@RabbitListener(errorHandler = ...)andreturnExceptionsare ignored for synchronous failures on an AMQP 1.0 container; the async path already delegates throughasyncFailure(). This routes synchronous failures throughhandleException()likeonMessage()does.