INT-4317: JMS: dynamic deliverMode and timeToLive (#2561)
* INT-4317: JMS: dynamic deliverMode and timeToLive JIRA: https://jira.spring.io/browse/INT-4317 * Add `deliveryModeExpression` and `timeToLiveExpression` properties to the `JmsSendingMessageHandler` and expose them in the Java DSL and XML components * Add `setMapInboundDeliveryMode()` and `setMapInboundExpiration()` `boolean` properties (default `false`) to the `DefaultJmsHeaderMapper` for transferring `JMSDeliveryMode` and `JMSExpiration` into appropriate `JmsHeaders.DELIVERY_MODE` and `JmsHeaders.EXPIRATION` headers * Upgrade to latest Kotlin and AssertK * Upgrade to Kotlin 1.2.61
This commit is contained in:
committed by
Gary Russell
parent
21338d1934
commit
90e4c54210
@@ -171,6 +171,17 @@ If, on the other hand, you want to send the actual Spring Integration message to
|
||||
NOTE: Regardless of the boolean value for payload extraction, the Spring Integration `MessageHeaders` map to JMS properties, as long as you rely on the default converter or provide a reference to another instance of `HeaderMappingMessageConverter`.
|
||||
(The same holds true for 'inbound' adapters, except that, in those cases, the JMS properties map to Spring Integration `MessageHeaders`).
|
||||
|
||||
Starting with version 5.1, the `<int-jms:outbound-channel-adapter>` (`JmsSendingMessageHandler`) can be configured with the `deliveryModeExpression` and `timeToLiveExpression` properties to evaluate an appropriate QoS values for JMS message to send at runtime against request Spring `Message`.
|
||||
The new `setMapInboundDeliveryMode(true)` and `setMapInboundExpiration(true)` options of the `DefaultJmsHeaderMapper` may facilitate as a source of the information for the dynamic `deliveryMode` and `timeToLive` from message headers:
|
||||
|
||||
====
|
||||
[source,xml]
|
||||
----
|
||||
<int-jms:outbound-channel-adapter delivery-mode-expression="headers.jms_deliveryMode"
|
||||
time-to-live-expression="headers.jms_expiration - T(System).currentTimeMillis()"/>
|
||||
----
|
||||
====
|
||||
|
||||
[[jms-ob-transactions]]
|
||||
==== Transactions
|
||||
|
||||
@@ -585,6 +596,22 @@ On the inbound side, it is mapped as a `String`.
|
||||
This is independent of the `jms_correlationId` header, which is mapped to and from the `JMSCorrelationID` header.
|
||||
The `JMSCorrelationID` is generally used to correlate requests and replies, whereas the `correlationId` is often used to combine related messages into a group (such as with an aggregator or a resequencer).
|
||||
|
||||
Starting with version 5.1, the `DefaultJmsHeaderMapper` can be configured for mapping inbound `JMSDeliveryMode` and `JMSExpiration` properties:
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
@Bean
|
||||
public DefaultJmsHeaderMapper jmsHeaderMapper() {
|
||||
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
|
||||
mapper.setMapInboundDeliveryMode(true)
|
||||
mapper.setMapInboundExpiration(true)
|
||||
return mapper;
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
These JMS properties are mapped to the `JmsHeaders.DELIVERY_MODE` and `JmsHeaders.EXPIRATION` Spring Message headers respectively.
|
||||
|
||||
[[jms-conversion-and-marshalling]]
|
||||
=== Message Conversion, Marshalling, and Unmarshalling
|
||||
|
||||
@@ -593,6 +620,7 @@ To do so, provide the bean name of an instance of `MessageConverter` that is ava
|
||||
Also, to provide some consistency with marshaller and unmarshaller interfaces, Spring provides `MarshallingMessageConverter`, which you can configure with your own custom marshallers and unmarshallers.
|
||||
The following example shows how to do so
|
||||
|
||||
====
|
||||
[source,xml]
|
||||
----
|
||||
<int-jms:inbound-gateway request-destination="requestQueue"
|
||||
@@ -609,6 +637,7 @@ The following example shows how to do so
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
----
|
||||
====
|
||||
|
||||
NOTE: When you provide your own `MessageConverter` instance, it is still wrapped within the `HeaderMappingMessageConverter`.
|
||||
This means that the 'extract-request-payload' and 'extract-reply-payload' properties can affect the actual objects passed to your converter.
|
||||
|
||||
@@ -152,3 +152,11 @@ In addition the key and trust store types can now be configured on the `DefaultT
|
||||
|
||||
Since the Spring Social project has moved to https://spring.io/blog/2018/07/03/spring-social-end-of-life-announcement[end of life status], Twitter support in Spring Integration has been moved to the Extensions project.
|
||||
See https://github.com/spring-projects/spring-integration-extensions/tree/master/spring-integration-social-twitter[Spring Integration Social Twitter] for more information.
|
||||
|
||||
[[x51.-jms]]
|
||||
=== JMS Support
|
||||
|
||||
The `JmsSendingMessageHandler` now provides `deliveryModeExpression` and `timeToLiveExpression` options to determine respective QoS options for JMS message to send at runtime.
|
||||
The `DefaultJmsHeaderMapper` now allows to map inbound `JMSDeliveryMode` and `JMSExpiration` properties via setting to `true` respective `setMapInboundDeliveryMode()` and `setMapInboundExpiration()` options.
|
||||
|
||||
See <<jms>> for more information.
|
||||
|
||||
Reference in New Issue
Block a user