public class JmsMessageUtils extends Object
JmsMessageUtils
contains helper method for dealing with JMS
messages in Mule.Modifier and Type | Field and Description |
---|---|
static char |
REPLACEMENT_CHAR |
Constructor and Description |
---|
JmsMessageUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.jms.Message |
copyJMSProperties(javax.jms.Message from,
javax.jms.Message to,
JmsConnector connector) |
static String |
encodeHeader(String name)
Encode a String so that is is a valid JMS header name
|
static String |
getNameForDestination(javax.jms.Destination dest) |
static byte[] |
toByteArray(javax.jms.Message message,
String jmsSpec) |
static javax.jms.Message |
toMessage(Object object,
javax.jms.Session session) |
static Object |
toObject(javax.jms.Message source,
String jmsSpec) |
public static final char REPLACEMENT_CHAR
public static String encodeHeader(String name)
name
- the String to encodepublic static javax.jms.Message toMessage(Object object, javax.jms.Session session) throws javax.jms.JMSException
javax.jms.JMSException
public static Object toObject(javax.jms.Message source, String jmsSpec) throws javax.jms.JMSException, IOException
javax.jms.JMSException
IOException
public static byte[] toByteArray(javax.jms.Message message, String jmsSpec) throws javax.jms.JMSException, IOException
message
- the message to receive the bytes from. Note this only works for
TextMessge, ObjectMessage, StreamMessage and BytesMessage.jmsSpec
- indicates the JMS API version, either
JmsConstants.JMS_SPECIFICATION_102B
or
JmsConstants.JMS_SPECIFICATION_11
. Any other value
including null
is treated as fallback to
JmsConstants.JMS_SPECIFICATION_102B
.javax.jms.JMSException
- if the message can't be read or if the message passed is
a MapMessageIOException
- if a failure occurs while reading the stream and
converting the message datapublic static String getNameForDestination(javax.jms.Destination dest) throws javax.jms.JMSException
javax.jms.JMSException
public static javax.jms.Message copyJMSProperties(javax.jms.Message from, javax.jms.Message to, JmsConnector connector) throws javax.jms.JMSException
javax.jms.JMSException
Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.