Spring Framework

org.springframework.jms.support.converter
Interface MessageConverter

All Known Implementing Classes:
MappingJacksonMessageConverter, MarshallingMessageConverter, SimpleMessageConverter, SimpleMessageConverter102

public interface MessageConverter

Strategy interface that specifies a converter between Java objects and JMS messages.

Check out SimpleMessageConverter for 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), MessageListenerAdapter.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
 java.lang.Object fromMessage(javax.jms.Message message)
          Convert from a JMS Message to a Java object.
 javax.jms.Message toMessage(java.lang.Object object, javax.jms.Session session)
          Convert a Java object to a JMS Message using the supplied session to create the message object.
 

Method Detail

toMessage

javax.jms.Message toMessage(java.lang.Object object,
                            javax.jms.Session session)
                            throws javax.jms.JMSException,
                                   MessageConversionException
Convert a Java object to a JMS Message using the supplied session to create the message object.

Parameters:
object - the object to convert
session - the Session to use for creating a JMS Message
Returns:
the JMS Message
Throws:
javax.jms.JMSException - if thrown by JMS API methods
MessageConversionException - in case of conversion failure

fromMessage

java.lang.Object fromMessage(javax.jms.Message message)
                             throws javax.jms.JMSException,
                                    MessageConversionException
Convert from a JMS Message to a Java object.

Parameters:
message - the message to convert
Returns:
the converted Java object
Throws:
javax.jms.JMSException - if thrown by JMS API methods
MessageConversionException - in case of conversion failure

Spring Framework