org.mule.transport.jms
Class JmsMessageUtils
java.lang.Object
org.mule.transport.jms.JmsMessageUtils
public class JmsMessageUtils
- extends Object
JmsMessageUtils
contains helper method for dealing with JMS
messages in Mule.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REPLACEMENT_CHAR
public static final char REPLACEMENT_CHAR
- See Also:
- Constant Field Values
JmsMessageUtils
public JmsMessageUtils()
encodeHeader
public static String encodeHeader(String name)
- Encode a String so that is is a valid JMS header name
- Parameters:
name
- the String to encode
- Returns:
- a valid JMS header name
toMessage
public static Message toMessage(Object object,
Session session)
throws JMSException
- Throws:
JMSException
toObject
public static Object toObject(Message source,
String jmsSpec)
throws JMSException,
IOException
- Throws:
JMSException
IOException
toByteArray
public static byte[] toByteArray(Message message,
String jmsSpec)
throws JMSException,
IOException
- Parameters:
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
.
- Returns:
- a byte array corresponding with the message payload
- Throws:
JMSException
- if the message can't be read or if the message passed is
a MapMessage
IOException
- if a failure occurs while reading the stream and
converting the message data
getNameForDestination
public static String getNameForDestination(Destination dest)
throws JMSException
- Throws:
JMSException
copyJMSProperties
public static Message copyJMSProperties(Message from,
Message to,
JmsConnector connector)
throws JMSException
- Throws:
JMSException
Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.