Add AmqpMessagingListenerAdapter for AMQP 1.0 Client#3325
Merged
cppwfs merged 2 commits intospring-projects:mainfrom Feb 6, 2026
Merged
Add AmqpMessagingListenerAdapter for AMQP 1.0 Client#3325cppwfs merged 2 commits intospring-projects:mainfrom
AmqpMessagingListenerAdapter for AMQP 1.0 Client#3325cppwfs merged 2 commits intospring-projects:mainfrom
Conversation
* Add `throws Exception` to the `ProtonDeliveryListener.onDelivery()` contract to avoid any possible misleading transformations in the implementation * Add `AcknowledgingProtonDeliveryListener` contract as an extension of the `ProtonDeliveryListener`. Enforce its logic to a new contract with an `AmqpAcknowledgment` argument populated by the `AmqpMessageListenerContainer`. Such a contract is necessary to properly delegate replenish link credits logic back to the listener container. This logic is now included in the `AmqpMessageListenerContainer.doInvokeListener()` method. Either way, the target implementation is till free to deal with `Delivery` whatever is possible. However, there is a possibility of inconsistency when the container is paused, but listener calls `addCredit()` on the delivery's receiver * Add `HandlerAdapter.getMethod()` to avoid extra method parameter propagation to consumers of the `HandlerAdapter` * Extract `record ReplyExpressionRoot` from the `AbstractAdaptableMessageListener` to make it available for any other not RabbitMQ-based modules * Implement `AmqpMessagingListenerAdapter` for AMQP 1.0 client. It is similar to the `MessagingMessageListenerAdapter` for RabbitMQ-based modules, and is going to be used for POJO-based event-driven message handling, e.g. future `@AmqpListener`. A lot of `AmqpMessagingListenerAdapter` logic is really a copy/paste from the `MessagingMessageListenerAdapter` and its super class
Member
Author
|
This is like a foundation for the The logic mostly copied from the There are no tests in this PR for new Thanks |
cppwfs
requested changes
Feb 6, 2026
Contributor
cppwfs
left a comment
There was a problem hiding this comment.
Looks great!
Just a couple of comments.
...-client/src/main/java/org/springframework/amqp/client/listener/AmqpListenerErrorHandler.java
Outdated
Show resolved
Hide resolved
...ent/src/main/java/org/springframework/amqp/client/listener/AmqpMessagingListenerAdapter.java
Outdated
Show resolved
Hide resolved
...ent/src/main/java/org/springframework/amqp/client/listener/AmqpMessagingListenerAdapter.java
Outdated
Show resolved
Hide resolved
...ent/src/main/java/org/springframework/amqp/client/listener/AmqpMessagingListenerAdapter.java
Show resolved
Hide resolved
...ent/src/main/java/org/springframework/amqp/client/listener/AmqpMessagingListenerAdapter.java
Outdated
Show resolved
Hide resolved
...ent/src/main/java/org/springframework/amqp/client/listener/AmqpMessagingListenerAdapter.java
Show resolved
Hide resolved
* Fix typos in the `AmqpListenerErrorHandler` & `AmqpMessagingListenerAdapter` Javadocs * Remove redundant `@Nullable` from `AmqpMessagingListenerAdapter`'s `setErrorHandler()`, `setMessageConverter()` and `setBeanResolver()` * Remove `projectionUsed` property logic from the `AmqpMessagingListenerAdapter.invokeHandlerAndProcessResult()` as it looks like that message property is out of use anywhere in the project
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.
throws Exceptionto theProtonDeliveryListener.onDelivery()contract to avoid any possible misleading transformations in the implementationAcknowledgingProtonDeliveryListenercontract as an extension of theProtonDeliveryListener.Enforce its logic to a new contract with an
AmqpAcknowledgmentargument populated by theAmqpMessageListenerContainer.Such a contract is necessary to properly delegate replenish link credits logic back to the listener container.
This logic is now included in the
AmqpMessageListenerContainer.doInvokeListener()method. Either way, the target implementation is till free to deal withDeliverywhatever is possible. However, there is a possibility of inconsistency when the container is paused, but listener callsaddCredit()on the delivery's receiverHandlerAdapter.getMethod()to avoid extra method parameter propagation to consumers of theHandlerAdapterrecord ReplyExpressionRootfrom theAbstractAdaptableMessageListenerto make it available for any other not RabbitMQ-based modulesAmqpMessagingListenerAdapterfor AMQP 1.0 client. It is similar to theMessagingMessageListenerAdapterfor RabbitMQ-based modules, and is going to be used for POJO-based event-driven message handling, e.g. future@AmqpListener. A lot ofAmqpMessagingListenerAdapterlogic is really a copy/paste from theMessagingMessageListenerAdapterand its super class