类 MessagingMessageConverter
- java.lang.Object
- org.springframework.jms.support.converter.MessagingMessageConverter
- 所有已实现的接口:
InitializingBean,MessageConverter
public class MessagingMessageConverter extends Object implements MessageConverter, InitializingBean
Convert aMessagefrom the messaging abstraction to and from aMessageusing an underlyingMessageConverterfor the payload and aJmsHeaderMapperto map the JMS headers to and from standard message headers.- 从以下版本开始:
- 4.1
- 作者:
- Stephane Nicoll
构造器概要
构造器 构造器 说明 MessagingMessageConverter()Create 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.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected MessagecreateMessageForPayload(Object payload, Session session)已过时。as of 4.3, usecreateMessageForPayload(Object, Session, Object)protected MessagecreateMessageForPayload(Object payload, Session session, Object conversionHint)Create a JMS message for the specified payload and conversionHint.protected MessageHeadersextractHeaders(Message message)protected ObjectextractPayload(Message message)Extract the payload of the specifiedMessage.ObjectfromMessage(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.MessagetoMessage(Object object, Session session)Convert a Java object to a JMS Message using the supplied session to create the message object.
构造器详细资料
MessagingMessageConverter
public MessagingMessageConverter()
Create an instance with a default payload converter.
MessagingMessageConverter
public MessagingMessageConverter(MessageConverter payloadConverter)
Create an instance with the specific payload converter.- 参数:
payloadConverter- the payload converter to use- 从以下版本开始:
- 4.3.12
MessagingMessageConverter
public MessagingMessageConverter(MessageConverter payloadConverter, JmsHeaderMapper headerMapper)
Create an instance with the specified payload converter and header mapper.
方法详细资料
setPayloadConverter
public void setPayloadConverter(MessageConverter payloadConverter)
Set theMessageConverterto use to convert the payload.
setHeaderMapper
public void setHeaderMapper(JmsHeaderMapper headerMapper)
Set theJmsHeaderMapperto use to map JMS headers to and from standard message headers.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明: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.
- 指定者:
afterPropertiesSet在接口中InitializingBean
toMessage
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException
从接口复制的说明:MessageConverterConvert a Java object to a JMS Message using the supplied session to create the message object.- 指定者:
toMessage在接口中MessageConverter- 参数:
object- the object to convertsession- the Session to use for creating a JMS Message- 返回:
- the JMS Message
- 抛出:
JMSException- if thrown by JMS API methodsMessageConversionException- in case of conversion failure
fromMessage
public Object fromMessage(Message message) throws JMSException, MessageConversionException
从接口复制的说明:MessageConverterConvert from a JMS Message to a Java object.- 指定者:
fromMessage在接口中MessageConverter- 参数:
message- the message to convert- 返回:
- the converted Java object
- 抛出:
JMSException- if thrown by JMS API methodsMessageConversionException- in case of conversion failure
extractPayload
protected Object extractPayload(Message message) throws JMSException
Extract the payload of the specifiedMessage.- 抛出:
JMSException
createMessageForPayload
@Deprecated protected Message createMessageForPayload(Object payload, Session session) throws JMSException
已过时。as of 4.3, usecreateMessageForPayload(Object, Session, Object)Create a JMS message for the specified payload.
createMessageForPayload
protected Message createMessageForPayload(Object payload, Session session, Object conversionHint) throws JMSException
Create a JMS message for the specified payload and conversionHint. The conversion hint is an extra object passed to theMessageConverter, e.g. the associatedMethodParameter(may benull}.- 抛出:
JMSException- 从以下版本开始:
- 4.3
- 另请参阅:
MessageConverter.toMessage(Object, Session)
extractHeaders
protected final MessageHeaders extractHeaders(Message message)