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() . These examples are extracted from open source projects. 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
/**
 * 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
/**
 * 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
/**
 * 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
/**
 * 把{@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);
}