public class MessagingMessageConverter extends Object implements MessageConverter, InitializingBean
Message
from the messaging abstraction to and from a
Message
using an underlying MessageConverter
for the payload and a JmsHeaderMapper
to map the JMS headers to and from standard message headers.Constructor and Description |
---|
MessagingMessageConverter()
Create an instance with a default payload converter.
|
MessagingMessageConverter(MessageConverter payloadConverter,
JmsHeaderMapper headerMapper)
Create an instance with the specified payload converter and
header mapper.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
protected Object |
extractPayload(Message message)
Extract the payload of the specified
Message . |
Object |
fromMessage(Message message)
Convert from a JMS Message to a Java object.
|
void |
setHeaderMapper(JmsHeaderMapper headerMapper)
Set the
JmsHeaderMapper to use to map JMS headers to and from
standard message headers. |
void |
setPayloadConverter(MessageConverter payloadConverter)
Set the
MessageConverter to use to convert the payload. |
Message |
toMessage(Object object,
Session session)
Convert a Java object to a JMS Message using the supplied session
to create the message object.
|
public MessagingMessageConverter()
SimpleMessageConverter
,
SimpleJmsHeaderMapper
public MessagingMessageConverter(MessageConverter payloadConverter, JmsHeaderMapper headerMapper)
public void setPayloadConverter(MessageConverter payloadConverter)
MessageConverter
to use to convert the payload.public void setHeaderMapper(JmsHeaderMapper headerMapper)
JmsHeaderMapper
to use to map JMS headers to and from
standard message headers.public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException
MessageConverter
toMessage
in interface MessageConverter
object
- the object to convertsession
- the Session to use for creating a JMS MessageJMSException
- if thrown by JMS API methodsMessageConversionException
- in case of conversion failurepublic Object fromMessage(Message message) throws JMSException, MessageConversionException
MessageConverter
fromMessage
in interface MessageConverter
message
- the message to convertJMSException
- if thrown by JMS API methodsMessageConversionException
- in case of conversion failureprotected Object extractPayload(Message message) throws JMSException
Message
.JMSException