类 MessagingMessageConverter
- java.lang.Object
- org.springframework.jms.support.converter.MessagingMessageConverter
- 所有已实现的接口:
InitializingBean
,MessageConverter
public class MessagingMessageConverter extends Object implements MessageConverter, InitializingBean
Convert aMessage
from the messaging abstraction to and from aMessage
using an underlyingMessageConverter
for the payload and aJmsHeaderMapper
to 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.protected Message
createMessageForPayload(Object payload, Session session, Object conversionHint)
Create a JMS message for the specified payload and conversionHint.protected MessageHeaders
extractHeaders(Message message)
protected Object
extractPayload(Message message)
Extract the payload of the specifiedMessage
.Object
fromMessage(Message message)
Convert from a JMS Message to a Java object.void
setHeaderMapper(JmsHeaderMapper headerMapper)
Set theJmsHeaderMapper
to use to map JMS headers to and from standard message headers.void
setPayloadConverter(MessageConverter payloadConverter)
Set theMessageConverter
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.
构造器详细资料
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 theMessageConverter
to use to convert the payload.
setHeaderMapper
public void setHeaderMapper(JmsHeaderMapper headerMapper)
Set theJmsHeaderMapper
to use to map JMS headers to and from standard message headers.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.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
从接口复制的说明:MessageConverter
Convert 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
从接口复制的说明:MessageConverter
Convert 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
protected 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
, e.g. the associatedMethodParameter
(may benull
}.- 抛出:
JMSException
- 从以下版本开始:
- 4.3
- 另请参阅:
MessageConverter.toMessage(Object, Session)
extractHeaders
protected final MessageHeaders extractHeaders(Message message)