org.mule.transport.jms
Class JmsMessageAdapter

java.lang.Object
  extended by org.mule.transport.AbstractMessageAdapter
      extended by org.mule.transport.jms.JmsMessageAdapter
All Implemented Interfaces:
Serializable, ThreadSafeAccess, MessageAdapter

public class JmsMessageAdapter
extends AbstractMessageAdapter

JmsMessageAdapter allows a DefaultMuleEvent 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.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mule.api.ThreadSafeAccess
ThreadSafeAccess.AccessControl
 
Field Summary
 
Fields inherited from class org.mule.transport.AbstractMessageAdapter
attachments, exceptionPayload, id, logger, properties
 
Fields inherited from interface org.mule.api.ThreadSafeAccess
READ, WRITE
 
Constructor Summary
protected JmsMessageAdapter(JmsMessageAdapter template)
           
  JmsMessageAdapter(Object message)
           
 
Method Summary
 Object getPayload()
           
 byte[] getPayloadAsBytes()
          Converts the message implementation into a String representation
 String getPayloadAsString(String encoding)
          Converts the message implementation into a String representation
 ThreadSafeAccess newThreadCopy()
          
 void setCorrelationId(String id)
          Sets a correlationId for this message.
 void setReplyTo(Object replyTo)
          Sets a replyTo address for this message.
 void setSpecification(String newSpec)
           
 
Methods inherited from class org.mule.transport.AbstractMessageAdapter
addAttachment, addInboundProperties, addProperties, addProperties, assertAccess, clearProperties, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getStringProperty, getUniqueId, isDisabled, newException, release, removeAttachment, removeProperty, resetAccessControl, setBooleanProperty, setCorrelationGroupSize, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setProperty, 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 MessagingException
Throws:
MessagingException

JmsMessageAdapter

protected JmsMessageAdapter(JmsMessageAdapter template)
Method Detail

setSpecification

public void setSpecification(String newSpec)

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

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.

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

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.

Specified by:
setReplyTo in interface MessageAdapter
Overrides:
setReplyTo in class AbstractMessageAdapter
Parameters:
replyTo - the endpointUri url to reply to

newThreadCopy

public ThreadSafeAccess newThreadCopy()
Description copied from class: AbstractMessageAdapter

Specified by:
newThreadCopy in interface ThreadSafeAccess
Overrides:
newThreadCopy in class AbstractMessageAdapter
Returns:
A new instance of the implementing class, unbound to any thread and mutable.


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.