17.2 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.

 <jms:message-driven-channel-adapter id="jmsIn" destination="inQueue" channel="exampleChannel"/>

[Note]Note
The Message-Driven adapter also accepts several properties that pertain to the MessageListener container. These values are only considered if you do not provide an actual 'container' reference. In that case, an instance of DefaultMessageListenerContainer will be created and configured based on these properties. For example, you can specify the "transaction-manager" reference, the "concurrent-consumers" value, and several other property references and values. Refer to the JavaDoc and Spring Integration's JMS Schema (spring-integration-jms-1.0.xsd) for more detail.

The 'extract-payload' property has the same effect as described above, and once again its default value is 'true'. Of course, the poller sub-element is not required (not accepted actually) for a message-driven Channel Adapter. For most usage scenarios, the message-driven approach is better since the Messages will be passed along to the Spring Integration Message Channel as soon as they are received from the underlying JMS consumer.