本文整理汇总了Java中org.springframework.jms.support.converter.MessageConverter.fromMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MessageConverter.fromMessage方法的具体用法?Java MessageConverter.fromMessage怎么用?Java MessageConverter.fromMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jms.support.converter.MessageConverter
的用法示例。
在下文中一共展示了MessageConverter.fromMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncRetrieve
import org.springframework.jms.support.converter.MessageConverter; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T syncRetrieve() throws Exception
{
if (logger.isDebugEnabled())
{
Message msg = this.getTemplateConsumer().receive();
logger.debug("***** SYNC CONSUMING MESSAGE******");
traceMessage(msg);
MessageConverter mc = ((IJMSServiceConsumer<?>) this).getTemplateConsumer()
.getMessageConverter();
return (T) mc.fromMessage(msg);
}
else
return (T) ((IJMSServiceConsumer<?>) this).getTemplateConsumer()
.receiveAndConvert();
}
示例2: extractMessage
import org.springframework.jms.support.converter.MessageConverter; //导入方法依赖的package包/类
/**
* Extract the message body from the given JMS message.
* @param message the JMS {@code Message}
* @return the content of the message, to be passed into the listener method
* as an argument
* @throws MessageConversionException if the message could not be extracted
*/
protected Object extractMessage(Message message) {
try {
MessageConverter converter = getMessageConverter();
if (converter != null) {
return converter.fromMessage(message);
}
return message;
}
catch (JMSException ex) {
throw new MessageConversionException("Could not convert JMS message", ex);
}
}
示例3: extractMessage
import org.springframework.jms.support.converter.MessageConverter; //导入方法依赖的package包/类
/**
* Extract the message body from the given JMS message.
* @param message the JMS {@code Message}
* @return the content of the message, to be passed into the
* listener method as argument
* @throws JMSException if thrown by JMS API methods
*/
protected Object extractMessage(Message message) throws JMSException {
MessageConverter converter = getMessageConverter();
if (converter != null) {
return converter.fromMessage(message);
}
return message;
}
示例4: fromMessage
import org.springframework.jms.support.converter.MessageConverter; //导入方法依赖的package包/类
@Override
public Object fromMessage(Message message) throws JMSException, MessageConversionException {
MessageConverter converter = getMessageConverterFrom(message);
return converter.fromMessage(message);
}
示例5: fromMessage
import org.springframework.jms.support.converter.MessageConverter; //导入方法依赖的package包/类
/**
* 把{@link Message}转换成对象
*
* @param messageConverter
* @param message
* @param <T>
* @return
* @throws JMSException
*/
public static <T> T fromMessage(MessageConverter messageConverter, Message message) throws JMSException {
return (T) messageConverter.fromMessage(message);
}