Java Code Examples for org.springframework.jms.support.converter.MessageConverter#fromMessage()
The following examples show how to use
org.springframework.jms.support.converter.MessageConverter#fromMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractAdaptableMessageListener.java From spring-analysis-note with MIT License | 5 votes |
/** * 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); } }
Example 2
Source File: AbstractAdaptableMessageListener.java From java-technology-stack with MIT License | 5 votes |
/** * 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); } }
Example 3
Source File: AbstractAdaptableMessageListener.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * 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); } }
Example 4
Source File: MessageConvertUtils.java From artemis-disruptor-miaosha with Apache License 2.0 | 2 votes |
/** * 把{@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); }