Class MessagingMessageConverter
java.lang.Object
org.springframework.jms.support.converter.MessagingMessageConverter
- All Implemented Interfaces:
- InitializingBean,- MessageConverter
Convert a 
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.- Since:
- 4.1
- Author:
- Stephane Nicoll
- 
Constructor SummaryConstructorsConstructorDescriptionCreate an instance with a default payload converter.MessagingMessageConverter(MessageConverter payloadConverter) Create an instance with the specific payload converter.MessagingMessageConverter(MessageConverter payloadConverter, JmsHeaderMapper headerMapper) Create an instance with the specified payload converter and header mapper.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected MessagecreateMessageForPayload(Object payload, Session session, @Nullable Object conversionHint) Create a JMS message for the specified payload and conversionHint.protected final MessageHeadersextractHeaders(Message message) protected ObjectextractPayload(Message message) Extract the payload of the specifiedMessage.fromMessage(Message message) Convert from a JMS Message to a Java object.voidsetHeaderMapper(JmsHeaderMapper headerMapper) Set theJmsHeaderMapperto use to map JMS headers to and from standard message headers.voidsetPayloadConverter(MessageConverter payloadConverter) Set theMessageConverterto use to convert the payload.Convert a Java object to a JMS Message using the supplied session to create the message object.
- 
Constructor Details- 
MessagingMessageConverterpublic MessagingMessageConverter()Create an instance with a default payload converter.- See Also:
 
- 
MessagingMessageConverterCreate an instance with the specific payload converter.- Parameters:
- payloadConverter- the payload converter to use
- Since:
- 4.3.12
 
- 
MessagingMessageConverterCreate an instance with the specified payload converter and header mapper.
 
- 
- 
Method Details- 
setPayloadConverterSet theMessageConverterto use to convert the payload.
- 
setHeaderMapperSet theJmsHeaderMapperto use to map JMS headers to and from standard message headers.
- 
afterPropertiesSetpublic void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
toMessagepublic Message toMessage(Object object, Session session) throws JMSException, MessageConversionException Description copied from interface:MessageConverterConvert a Java object to a JMS Message using the supplied session to create the message object.- Specified by:
- toMessagein interface- MessageConverter
- Parameters:
- object- the object to convert
- session- the Session to use for creating a JMS Message
- Returns:
- the JMS Message
- Throws:
- JMSException- if thrown by JMS API methods
- MessageConversionException- in case of conversion failure
 
- 
fromMessageDescription copied from interface:MessageConverterConvert from a JMS Message to a Java object.- Specified by:
- fromMessagein interface- MessageConverter
- Parameters:
- message- the message to convert
- Returns:
- the converted Java object
- Throws:
- JMSException- if thrown by JMS API methods
- MessageConversionException- in case of conversion failure
 
- 
extractPayloadExtract the payload of the specifiedMessage.- Throws:
- JMSException
 
- 
createMessageForPayloadprotected Message createMessageForPayload(Object payload, Session session, @Nullable Object conversionHint) throws JMSException Create a JMS message for the specified payload and conversionHint. The conversion hint is an extra object passed to theMessageConverter, for example, the associatedMethodParameter(may benull}.- Throws:
- JMSException
- Since:
- 4.3
- See Also:
 
- 
extractHeaders
 
-