Top Description Methods
org.springframework.jms.support.converter

public Interface MessageConverter

Known Direct Subinterfaces
org.springframework.jms.support.converter.SmartMessageConverter
Known Direct Implementers
org.springframework.jms.support.converter.MessagingMessageConverter, org.springframework.jms.support.converter.SimpleMessageConverter, org.springframework.jms.support.converter.MarshallingMessageConverter
Imports
jakarta.jms.JMSException, .Message, .Session

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.

Authors
Mark Pollack, Juergen Hoeller
Since
1.1
See Also
org.springframework.jms.core.JmsTemplate#setMessageConverter, org.springframework.jms.listener.adapter.MessageListenerAdapter#setMessageConverter

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the converted Java object
fromMessage
(Message
the message to convert
message
)

Convert from a JMS Message to a Java object.

public Message

Returns:

the JMS Message
toMessage
(Object
the object to convert
object
,
Session
the Session to use for creating a JMS Message
session
)

Convert a Java object to a JMS Message using the supplied session to create the message object.

Method Detail

fromMessageback to summary
public Object fromMessage(Message message) throws JMSException, MessageConversionException

Convert from a JMS Message to a Java object.

Parameters
message:Message

the message to convert

Returns:Object

the converted Java object

Exceptions
JMSException:
if thrown by JMS API methods
MessageConversionException:
in case of conversion failure
toMessageback to summary
public 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:Object

the object to convert

session:Session

the Session to use for creating a JMS Message

Returns:Message

the JMS Message

Exceptions
JMSException:
if thrown by JMS API methods
MessageConversionException:
in case of conversion failure