public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageListener
MessageListener
adapter that invokes a configurable
InvocableHandlerMethod
.
Wraps the incoming Message
to Spring's Message
abstraction, copying the JMS standard headers using a configurable
JmsHeaderMapper
.
The original Message
and the Session
are provided as additional arguments so that these can be injected as
method arguments if necessary.
Message
,
JmsHeaderMapper
,
InvocableHandlerMethod
logger
Constructor and Description |
---|
MessagingMessageListenerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
onMessage(Message jmsMessage,
Session session)
Callback for processing a received JMS message.
|
protected java.lang.Object |
preProcessResponse(java.lang.Object result)
Pre-process the given result before it is converted to a
Message . |
void |
setHandlerMethod(InvocableHandlerMethod handlerMethod)
Set the
InvocableHandlerMethod to use to invoke the method
processing an incoming Message . |
protected Message<?> |
toMessagingMessage(Message jmsMessage) |
buildMessage, extractMessage, getDestinationResolver, getMessageConverter, getMessagingMessageConverter, getResponseDestination, getResponseQosSettings, handleListenerException, handleResult, onMessage, postProcessProducer, postProcessResponse, resolveDefaultResponseDestination, sendResponse, setDefaultResponseDestination, setDefaultResponseQueueName, setDefaultResponseTopicName, setDestinationResolver, setHeaderMapper, setMessageConverter, setResponseQosSettings
public void setHandlerMethod(InvocableHandlerMethod handlerMethod)
InvocableHandlerMethod
to use to invoke the method
processing an incoming Message
.public void onMessage(Message jmsMessage, @Nullable Session session) throws JMSException
SessionAwareMessageListener
Implementors are supposed to process the given Message, typically sending reply messages through the given Session.
onMessage
in interface SessionAwareMessageListener<Message>
onMessage
in class AbstractAdaptableMessageListener
jmsMessage
- the received JMS message (never null
)session
- the underlying JMS Session (never null
)JMSException
- if thrown by JMS methodsprotected java.lang.Object preProcessResponse(java.lang.Object result)
AbstractAdaptableMessageListener
Message
.preProcessResponse
in class AbstractAdaptableMessageListener
result
- the result of the invocationresult
argument
or any other object (for instance wrapping the result).