Interface MessageConverter
- All Known Subinterfaces:
SmartMessageConverter
- All Known Implementing Classes:
MappingJackson2MessageConverter,MarshallingMessageConverter,MessagingMessageConverter,SimpleMessageConverter
public interface MessageConverter
Strategy interface that specifies a converter between Java objects and JMS messages.Check out
SimpleMessageConverterfor a default implementation, converting between the 'standard' message payloads and JMS Message types.- Since:
- 1.1
- Author:
- Mark Pollack, Juergen Hoeller
- See Also:
JmsTemplate.setMessageConverter(org.springframework.jms.support.converter.MessageConverter),AbstractAdaptableMessageListener.setMessageConverter(org.springframework.jms.support.converter.MessageConverter),JmsInvokerClientInterceptor.setMessageConverter(org.springframework.jms.support.converter.MessageConverter),JmsInvokerServiceExporter.setMessageConverter(org.springframework.jms.support.converter.MessageConverter)
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectfromMessage(Message message)Convert from a JMS Message to a Java object.MessagetoMessage(Object object, Session session)Convert a Java object to a JMS Message using the supplied session to create the message object.
Method Detail
toMessage
Message toMessage(Object object, Session session) throws JMSException, MessageConversionException
Convert a Java object to a JMS Message using the supplied session to create the message object.- Parameters:
object- the object to convertsession- the Session to use for creating a JMS Message- Returns:
- the JMS Message
- Throws:
JMSException- if thrown by JMS API methodsMessageConversionException- in case of conversion failure
fromMessage
Object fromMessage(Message message) throws JMSException, MessageConversionException
Convert from a JMS Message to a Java object.- Parameters:
message- the message to convert- Returns:
- the converted Java object
- Throws:
JMSException- if thrown by JMS API methodsMessageConversionException- in case of conversion failure