Package org.springframework.jms.listener
Interface SessionAwareMessageListener<M extends Message>
- Type Parameters:
M
- the message type
- All Known Implementing Classes:
AbstractAdaptableMessageListener
,JmsInvokerServiceExporter
,MessageListenerAdapter
,MessagingMessageListenerAdapter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface SessionAwareMessageListener<M extends Message>
Variant of the standard JMSMessageListener
interface, offering not only the received Message but also the underlying JMS Session object. The latter can be used to send reply messages, without the need to access an external Connection/Session, i.e. without the need to access the underlying ConnectionFactory.Supported by Spring's
DefaultMessageListenerContainer
andSimpleMessageListenerContainer
, as direct alternative to the standard JMS MessageListener interface. Typically not supported by JCA-based listener containers: For maximum compatibility, implement a standard JMS MessageListener instead.- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
AbstractMessageListenerContainer.setMessageListener(java.lang.Object)
,DefaultMessageListenerContainer
,SimpleMessageListenerContainer
,JmsMessageEndpointManager
,MessageListener
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onMessage(M message, Session session)
Callback for processing a received JMS message.
Method Detail
onMessage
void onMessage(M message, Session session) throws JMSException
Callback for processing a received JMS message.Implementors are supposed to process the given Message, typically sending reply messages through the given Session.
- Parameters:
message
- the received JMS message (nevernull
)session
- the underlying JMS Session (nevernull
)- Throws:
JMSException
- if thrown by JMS methods