org.mule.providers.jms
Class JmsMessageAdapter

java.lang.Object
  extended byorg.mule.providers.AbstractMessageAdapter
      extended byorg.mule.providers.jms.JmsMessageAdapter
All Implemented Interfaces:
Serializable, org.mule.umo.provider.UMOMessageAdapter

public class JmsMessageAdapter
extends org.mule.providers.AbstractMessageAdapter

JmsMessageAdapter allows a MuleEvent to access the properties and payload of a JMS Message in a uniform way. The JmsMessageAdapter expects a message of type javax.jms.Message and will throw an IllegalArgumentException if the source message type is not compatible. The JmsMessageAdapter should be suitable for all JMS Connector implementations.

Version:
$Revision: 3167 $
Author:
Ross Mason
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mule.providers.AbstractMessageAdapter
attachments, encoding, exceptionPayload, id, logger, properties
 
Constructor Summary
JmsMessageAdapter(Object message)
           
 
Method Summary
 String getCorrelationId()
          Sets a correlationId for this message.
 Object getPayload()
           
 byte[] getPayloadAsBytes()
          Converts the message implementation into a String representation
 String getPayloadAsString(String encoding)
          Converts the message implementation into a String representation
 Object getReplyTo()
          Sets a replyTo address for this message.
 String getUniqueId()
           
 void setCorrelationId(String id)
          Sets a correlationId for this message.
 void setReplyTo(Object replyTo)
          Sets a replyTo address for this message.
 
Methods inherited from class org.mule.providers.AbstractMessageAdapter
addAttachment, addProperties, clearProperties, convertToBytes, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getPayloadAsString, getProperty, getProperty, getPropertyNames, getStringProperty, removeAttachment, removeProperty, setBooleanProperty, setCorrelationGroupSize, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setProperty, setStringProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JmsMessageAdapter

public JmsMessageAdapter(Object message)
                  throws org.mule.umo.MessagingException
Method Detail

getPayloadAsString

public String getPayloadAsString(String encoding)
                          throws Exception
Converts the message implementation into a String representation

Parameters:
encoding - The encoding to use when transforming the message (if necessary). The parameter is used when converting from a byte array
Returns:
String representation of the message payload
Throws:
Exception - Implementation may throw an endpoint specific exception

getPayloadAsBytes

public byte[] getPayloadAsBytes()
                         throws Exception
Converts the message implementation into a String representation

Returns:
String representation of the message
Throws:
Exception - Implemetation may throw an endpoint specific exception

getPayload

public Object getPayload()
Returns:
the current message

getUniqueId

public String getUniqueId()

setCorrelationId

public void setCorrelationId(String id)
Sets a correlationId for this message. The correlation Id can be used by components in the system to manage message relations

transport protocol. As such not all messages will support the notion of a correlationId i.e. tcp or file. In this situation the correlation Id is set as a property of the message where it's up to developer to keep the association with the message. For example if the message is serialised to xml the correlationId will be available in the message.

Parameters:
id - the Id reference for this relationship

getCorrelationId

public String getCorrelationId()
Sets a correlationId for this message. The correlation Id can be used by components in the system to manage message relations.

The correlationId is associated with the message using the underlying transport protocol. As such not all messages will support the notion of a correlationId i.e. tcp or file. In this situation the correlation Id is set as a property of the message where it's up to developer to keep the association with the message. For example if the message is serialised to xml the correlationId will be available in the message.

Returns:
the correlationId for this message or null if one hasn't been set

setReplyTo

public void setReplyTo(Object replyTo)
Sets a replyTo address for this message. This is useful in an asynchronous environment where the caller doesn't wait for a response and the response needs to be routed somewhere for further processing. The value of this field can be any valid endpointUri url.

Parameters:
replyTo - the endpointUri url to reply to

getReplyTo

public Object getReplyTo()
Sets a replyTo address for this message. This is useful in an asynchronous environment where the caller doesn't wait for a response and the response needs to be routed somewhere for further processing. The value of this field can be any valid endpointUri url.

Returns:
the endpointUri url to reply to or null if one has not been set


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.