NOTE: This class requires a JMS 1.1+ provider, because it builds
on the domain-independent API. Use the MessageListenerAdapter102 subclass for JMS 1.0.2 providers.

By default, the content of incoming JMS messages gets extracted before
being passed into the target listener method, to let the target method
operate on message content types such as String or byte array instead of
the raw Message. Message type conversion is delegated to a Spring
JMS MessageConverter. By default, a SimpleMessageConverter(102)
will be used. (If you do not want such automatic message conversion taking
place, then be sure to set the MessageConverter
to null.)

If a target listener method returns a non-null object (typically of a
message content type such as String or byte array), it will get
wrapped in a JMS Message and sent to the response destination
(either the JMS "reply-to" destination or a
specified default
destination).

Note: The sending of response messages is only available when
using the SessionAwareMessageListener entry point (typically through a
Spring message listener container). Usage as standard JMS MessageListener
does not support the generation of response messages.

Find below some examples of method signatures compliant with this
adapter class. This first example handles all Message types
and gets passed the contents of each Message type as an
argument. No Message will be sent back as all of these
methods return void.

This next example illustrates a Message delegate
that just consumes the String contents of
TextMessages. Notice also how the
name of the Message handling method is different from the
original (this will have to
be configured in the attandant bean definition). Again, no Message
will be sent back as the method returns void.

This final example illustrates a Message delegate
that just consumes the String contents of
TextMessages. Notice how the return type
of this method is String: This will result in the configured
MessageListenerAdapter sending a TextMessage in response.

setMessageConverter(MessageConverter messageConverter)
Set the converter that will convert incoming JMS messages to
listener method arguments, and objects returned from listener
methods back to JMS messages.

onMessage

Delegates the message to the target listener method, with appropriate
conversion of the message argument. In case of an exception, the
handleListenerException(Throwable) method will be invoked.

Note: Does not support sending response messages based on
result objects returned from listener methods. Use the
SessionAwareMessageListener entry point (typically through a Spring
message listener container) for handling result objects as well.

buildListenerArguments

Build an array of arguments to be passed into the target listener method.
Allows for multiple method arguments to be built from a single message object.

The default implementation builds an array with the given message object
as sole element. This means that the extracted message will always be passed
into a single method argument, even if it is an array, with the target
method having a corresponding single argument of the array's type declared.

This can be overridden to treat special message content such as arrays
differently, for example passing in each element of the message array
as distinct method argument.

Parameters:

extractedMessage - the content of the message

Returns:

the array of arguments to be passed into the
listener method (each element of the array corresponding
to a distinct method argument)