org.mule.providers.jms
Class JmsMessageAdapter

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

public class JmsMessageAdapter
extends 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: 1.6 $
Author:
Ross Mason
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mule.providers.AbstractMessageAdapter
exceptionPayload, properties
 
Constructor Summary
JmsMessageAdapter(java.lang.Object message)
           
 
Method Summary
 java.lang.String getCorrelationId()
          Sets a correlationId for this message.
 java.lang.Object getPayload()
           
 byte[] getPayloadAsBytes()
          Converts the message implementation into a String representation
 java.lang.String getPayloadAsString()
          Converts the message implementation into a String representation
 java.lang.Object getReplyTo()
          Sets a replyTo address for this message.
 java.lang.String getUniqueId()
          gets the unique identifier for the message.
 void setCorrelationId(java.lang.String id)
          Sets a correlationId for this message.
 void setProperty(java.lang.Object key, java.lang.Object value)
          Set a property on the message
 
Methods inherited from class org.mule.providers.AbstractMessageAdapter
getBooleanProperty, getCorrelationGroupSize, getCorrelationSequence, getDoubleProperty, getExceptionPayload, getIntProperty, getLongProperty, getProperty, getProperty, getPropertyNames, removeProperty, setBooleanProperty, setCorrelationGroupSize, setCorrelationSequence, setDoubleProperty, setExceptionPayload, setIntProperty, setLongProperty, setReplyTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsMessageAdapter

public JmsMessageAdapter(java.lang.Object message)
                  throws MessagingException
Method Detail

getPayloadAsString

public java.lang.String getPayloadAsString()
                                    throws java.lang.Exception
Converts the message implementation into a String representation

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

getPayloadAsBytes

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

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

getPayload

public java.lang.Object getPayload()
Returns:
the current message

getUniqueId

public java.lang.String getUniqueId()
                             throws UniqueIdNotSupportedException
Description copied from interface: UMOMessageAdapter
gets the unique identifier for the message. It's up to the implementation to ensure a unique id

Specified by:
getUniqueId in interface UMOMessageAdapter
Overrides:
getUniqueId in class AbstractMessageAdapter
Throws:
UniqueIdNotSupportedException

setCorrelationId

public void setCorrelationId(java.lang.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.

Specified by:
setCorrelationId in interface UMOMessageAdapter
Overrides:
setCorrelationId in class AbstractMessageAdapter
Parameters:
id - the Id reference for this relationship

getCorrelationId

public java.lang.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.

Specified by:
getCorrelationId in interface UMOMessageAdapter
Overrides:
getCorrelationId in class AbstractMessageAdapter
Returns:
the correlationId for this message or null if one hasn't been set

getReplyTo

public java.lang.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.

Specified by:
getReplyTo in interface UMOMessageAdapter
Overrides:
getReplyTo in class AbstractMessageAdapter
Returns:
the endpointUri url to reply to or null if one has not been set

setProperty

public void setProperty(java.lang.Object key,
                        java.lang.Object value)
Description copied from interface: UMOMessageAdapter
Set a property on the message

Specified by:
setProperty in interface UMOMessageAdapter
Overrides:
setProperty in class AbstractMessageAdapter


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.