GH-8631: Add retry options to JMS inbound components

Fixes: #8631

The `ChannelPublishingJmsMessageListener` (and respective Java DSL specs)
can now be supplied with a `RetryTemplate` & `RecoveryCallback` for retying `send` & `send-and-receive` operations
in the internal gateway implementation.
The `JmsMessageHeaderErrorMessageStrategy` was introduced to have access into a raw JMS message from retry context.
The functionality is modeled after `AmqpInboundChannelAdapter`
This commit is contained in:
Artem Bilan
2024-03-13 13:42:07 -04:00
parent ffe3605c90
commit 2dea91b4c3
8 changed files with 276 additions and 17 deletions

View File

@@ -150,7 +150,7 @@ If you want the entire flow to be transactional (for example, if there is a down
Alternatively, consider using a `jms-message-driven-channel-adapter` with `acknowledge` set to `transacted` (the default).
[[jms-message-driven-channel-adapter]]
== Message-driven Channel Adapter
== Message Driven Channel Adapter
The `message-driven-channel-adapter` requires a reference to either an instance of a Spring `MessageListener` container (any subclass of `AbstractMessageListenerContainer`) or both `ConnectionFactory` and `Destination` (a 'destinationName' can be provided in place of the 'destination' reference).
The following example defines a message-driven channel adapter with a `Destination` reference:
@@ -269,6 +269,9 @@ Starting with version 5.1, when the endpoint is stopped while the application re
Previously, the connection and consumers remained open.
To revert to the previous behavior, set the `shutdownContainerOnStop` on the `JmsMessageDrivenEndpoint` to `false`.
Starting with version 6.3, the `ChannelPublishingJmsMessageListener` can now be supplied with a `RetryTemplate` and `RecoveryCallback<Message<?>>` for retries on the downstream send and send-and-receive operations.
These options are also exposed into a `JmsMessageDrivenChannelAdapterSpec` for Java DSL.
[[jms-md-conversion-errors]]
=== Inbound Conversion Errors
@@ -469,6 +472,8 @@ public IntegrationFlow jmsInboundGatewayFlow(ConnectionFactory connectionFactory
}
----
Starting with version 6.3, the `Jms.inboundGateway()` API exposes a `retryTemplate()` and `recoveryCallback()` options for retrying internal send-and-receive operations.
[[jms-outbound-gateway]]
== Outbound Gateway

View File

@@ -42,4 +42,10 @@ See xref:mqtt.adoc[MQTT Support] for more information.
=== Testing Support Changes
The `MockIntegrationContext.substituteTriggerFor()` API has been introduced.
See xref:testing.adoc[Testing Support] for more information.
See xref:testing.adoc[Testing Support] for more information.
[[x6.3-jms]]
=== JMS Support Changes
The `ChannelPublishingJmsMessageListener` can now be supplied with a `RetryTemplate` and `RecoveryCallback<Message<?>>` for retries on the downstream send operations.
See xref:jms.adoc#jms-message-driven-channel-adapter[Message Driven Channel Adapter] for more information.