18.5 Outbound Gateway

The outbound Gateway creates JMS Messages from Spring Integration Messages and then sends to a 'request-destination'. It will then handle the JMS reply Message either by using a selector to receive from the 'reply-destination' that you configure, or if no 'reply-destination' is provided, it will create JMS TemporaryQueues. Notice that the "reply-channel" is also provided.

 <jms:outbound-gateway id="jmsOutGateway"
                       request-destination="outQueue"
                       request-channel="outboundJmsRequests"
                       reply-channel="jmsReplies"/>

The 'outbound-gateway' payload extraction properties are inversely related to those of the 'inbound-gateway' (see the discussion above). That means that the 'extract-request-payload' property value applies to the Spring Integration Message that is being converted into a JMS Message to be sent as a request, and the 'extract-reply-payload' property value applies to the JMS Message that is received as a reply and then converted into a Spring Integration Message to be subsequently sent to the 'reply-channel' as shown in the example configuration above.

[Note]Note
For all of these JMS adapters, you can also specify your own "message-converter" reference. Simply provide the bean name of an instance of MessageConverter that is available within the same ApplicationContext. Note, however, that when you provide your own MessageConverter instance, it will still be wrapped within the HeaderMappingMessageConverter. This means that the 'extract-request-payload' and 'extract-reply-payload' properties may effect what actual objects are passed to your converter. The HeaderMappingMessageConverter itself simply delegates to a target MessageConverter while also mapping the Spring Integration MessageHeaders to JMS Message properties and vice-versa.