Class MessagingMessageListenerAdapter
- java.lang.Object
- org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener
- org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter
- All Implemented Interfaces:
MessageListener
,SessionAwareMessageListener<Message>
public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageListener
AMessageListener
adapter that invokes a configurableInvocableHandlerMethod
.Wraps the incoming
Message
to Spring'sMessage
abstraction, copying the JMS standard headers using a configurableJmsHeaderMapper
.The original
Message
and theSession
are provided as additional arguments so that these can be injected as method arguments if necessary.- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
Message
,JmsHeaderMapper
,InvocableHandlerMethod
Field Summary
Fields inherited from class org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener
logger
Constructor Summary
Constructors Constructor Description MessagingMessageListenerAdapter()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onMessage(Message jmsMessage, Session session)
Callback for processing a received JMS message.protected Object
preProcessResponse(Object result)
Pre-process the given result before it is converted to aMessage
.void
setHandlerMethod(InvocableHandlerMethod handlerMethod)
Set theInvocableHandlerMethod
to use to invoke the method processing an incomingMessage
.protected Message<?>
toMessagingMessage(Message jmsMessage)
Methods inherited from class org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener
buildMessage, extractMessage, getDestinationResolver, getMessageConverter, getMessagingMessageConverter, getResponseDestination, getResponseQosSettings, handleListenerException, handleResult, onMessage, postProcessProducer, postProcessResponse, resolveDefaultResponseDestination, sendResponse, setDefaultResponseDestination, setDefaultResponseQueueName, setDefaultResponseTopicName, setDestinationResolver, setHeaderMapper, setMessageConverter, setResponseQosSettings
Constructor Detail
MessagingMessageListenerAdapter
public MessagingMessageListenerAdapter()
Method Detail
setHandlerMethod
public void setHandlerMethod(InvocableHandlerMethod handlerMethod)
Set theInvocableHandlerMethod
to use to invoke the method processing an incomingMessage
.
onMessage
public void onMessage(Message jmsMessage, @Nullable Session session) throws JMSException
Description copied from interface:SessionAwareMessageListener
Callback for processing a received JMS message.Implementors are supposed to process the given Message, typically sending reply messages through the given Session.
- Specified by:
onMessage
in interfaceSessionAwareMessageListener<Message>
- Specified by:
onMessage
in classAbstractAdaptableMessageListener
- Parameters:
jmsMessage
- the received JMS message (nevernull
)session
- the underlying JMS Session (nevernull
)- Throws:
JMSException
- if thrown by JMS methods
preProcessResponse
protected Object preProcessResponse(Object result)
Description copied from class:AbstractAdaptableMessageListener
Pre-process the given result before it is converted to aMessage
.- Overrides:
preProcessResponse
in classAbstractAdaptableMessageListener
- Parameters:
result
- the result of the invocation- Returns:
- the payload response to handle, either the
result
argument or any other object (for instance wrapping the result).
toMessagingMessage
protected Message<?> toMessagingMessage(Message jmsMessage)