Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.api
Interface MuleMessage

All Superinterfaces:
  Serializable

All Known Subinterfaces:
  MuleMessageCollection

All Known Implementing Classes:
  DefaultMessageCollection, DefaultMuleMessage

    public interface MuleMessage

extends Serializable

`MuleMessage` represents a message payload. The Message comprises of the payload itself and properties associated with the payload.

Method Summary
`void` | `addAttachment(String name, DataHandler dataHandler)` Deprecated. use `#addOutboundAttachment(javax.activation.DataHandler)` instead
`void` | `addOutboundAttachment(String name, DataHandler dataHandler)` Allows for arbitrary data attachments to be associated with the Message.
`void` | `addOutboundAttachment(String name, Object object, String contentType)` Adds an outgoing attachment to the message
`void` | `addProperties(Map<String,Object> properties)` Deprecated. use `addProperties(java.util.Map, org.mule.api.transport.PropertyScope)` instead
`void` | `addProperties(Map<String,Object> properties, PropertyScope scope)` Adds a map of properties to be associated with this message
`void` | `applyTransformers(MuleEvent event, List<? extends Transformer> transformers)` Will apply a list of transformers to the payload of the message.
`void` | `applyTransformers(MuleEvent event, List<? extends Transformer> transformers, Class<?> outputType)` Will apply a list of transformers to the payload of the message.
`void` | `applyTransformers(MuleEvent event, Transformer... transformers)` Will apply a list of transformers to the payload of the message.
`void` | `clearProperties()` Deprecated. use `clearProperties(org.mule.api.transport.PropertyScope)` instead
`void` | `clearProperties(PropertyScope scope)` Removes all properties on this message in the given scope.
`MuleMessage` | `createInboundMessage()` Copy an inbound message to an outbound one, moving all message properties and attachments
`
`<T> T`
` | `findPropertyInAnyScope(String name, T defaultValue)` This method was added with the introduction of Property scopes.
`DataHandler` | `getAttachment(String name)` Deprecated. use `getInboundAttachment(String)` instead
`Set<String>` | `getAttachmentNames()` Deprecated. use `getInboundAttachmentNames()`
`boolean` | `getBooleanProperty(String name, boolean defaultValue)` Deprecated. use `getInboundProperty(String, Object)` instead
`int` | `getCorrelationGroupSize()` Determines how many messages are in the correlation group
`String` | `getCorrelationId()` Sets a correlationId for this message.
`int` | `getCorrelationSequence()` Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)
`DataType<?>` | `getDataType()` Returns the data type (if any) associated with the message's payload.
`double` | `getDoubleProperty(String name, double defaultValue)` Deprecated. use `getInboundProperty(String, Object)` instead
`String` | `getEncoding()` Gets the encoding for the current message.
`ExceptionPayload` | `getExceptionPayload()` If an error occurred during the processing of this message this will return a ErrorPayload that contains the root exception and Mule error code, plus any other releated info
`DataHandler` | `getInboundAttachment(String name)` Retrieve an attachment with the given name.
`Set<String>` | `getInboundAttachmentNames()`
`
`<T> T`
` | `getInboundProperty(String name)`
`
`<T> T`
` | `getInboundProperty(String name, T defaultValue)`
`Set<String>` | `getInboundPropertyNames()`
`int` | `getIntProperty(String name, int defaultValue)` Deprecated. use `getInboundProperty(String, Object)` instead
`
`<T> T`
` | `getInvocationProperty(String name)`
`
`<T> T`
` | `getInvocationProperty(String name, T defaultValue)`
`Set<String>` | `getInvocationPropertyNames()`
`long` | `getLongProperty(String name, long defaultValue)` Deprecated. use `getInboundProperty(String, Object)` instead
`MuleContext` | `getMuleContext()`
`Object` | `getOriginalPayload()` Returns the original payload used to create this message.
`DataHandler` | `getOutboundAttachment(String name)` Retrieve an attachment with the given name.
`Set<String>` | `getOutboundAttachmentNames()`
`
`<T> T`
` | `getOutboundProperty(String name)`
`
`<T> T`
` | `getOutboundProperty(String name, T defaultValue)`
`Set<String>` | `getOutboundPropertyNames()`
`Object` | `getPayload()`
`
`<T> T`
` | `getPayload(Class<T> outputType)` Will attempt to obtain the payload of this message with the desired Class type.
`
`<T> T`
` | `getPayload(DataType<T> outputType)` Will attempt to obtain the payload of this message with the desired Class type.
`byte[]` | `getPayloadAsBytes()` Converts the message implementation into a byte array representation
`String` | `getPayloadAsString()` Converts the message implementation into a String representation.
`String` | `getPayloadAsString(String encoding)` Converts the message implementation into a String representation
`Object` | `getProperty(String key)` Deprecated. use the overloaded version with an explicit lookup scope. This method will now use only the outbound scope.
`Object` | `getProperty(String name, Object defaultValue)` Deprecated. use scope-aware methods instead
`
`<T> T`
` | `getProperty(String name, PropertyScope scope)` Gets a property from the message with a given scope.
`
`<T> T`
` | `getProperty(String name, PropertyScope scope, T defaultValue)` Gets a property from the message with a given scope and provides a default value if the property is not present on the message in the scope specified.
`Set<String>` | `getPropertyNames()` Deprecated. use `getPropertyNames(org.mule.api.transport.PropertyScope)`
`Set<String>` | `getPropertyNames(PropertyScope scope)` Gets all property names in a given scope.
`Object` | `getReplyTo()` Returns a replyTo address for this message.
`
`<T> T`
` | `getSessionProperty(String name)`
`
`<T> T`
` | `getSessionProperty(String name, T defaultValue)`
`Set<String>` | `getSessionPropertyNames()`
`String` | `getStringProperty(String name, String defaultValue)` Deprecated. use `getInboundProperty(String, Object)` instead
`String` | `getUniqueId()` gets the unique identifier for the message.
`void` | `release()` Perform any clean up operations on the message resource.
`void` | `removeAttachment(String name)` Deprecated. use `removeOutboundAttachment(java.lang.String)` instead
`void` | `removeOutboundAttachment(String name)` Remove an attachment form this message with the specified name
`Object` | `removeProperty(String key)` Deprecated. use `removeProperty(String, org.mule.api.transport.PropertyScope)`
`Object` | `removeProperty(String key, PropertyScope scope)` Removes a property on this message from the specified scope only.
`void` | `setBooleanProperty(String name, boolean value)` Deprecated. use `setOutboundProperty(String, Object)` instead
`void` | `setCorrelationGroupSize(int size)` Determines how many messages are in the correlation group
`void` | `setCorrelationId(String id)` Sets a correlationId for this message.
`void` | `setCorrelationSequence(int sequence)` Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)
`void` | `setDoubleProperty(String name, double value)` Deprecated. use `setOutboundProperty(String, Object)` instead
`void` | `setEncoding(String encoding)` Sets the encoding for this message
`void` | `setExceptionPayload(ExceptionPayload payload)` If an error occurs while processing this message, a ErrorPayload is attached which contains the root exception and Mule error code, plus any other releated info.
`void` | `setIntProperty(String name, int value)` Deprecated. use `setOutboundProperty(String, Object)` instead
`void` | `setInvocationProperty(String key, Object value)`
`void` | `setLongProperty(String name, long value)` Deprecated. use `setOutboundProperty(String, Object)` instead
`void` | `setOutboundProperty(String key, Object value)`
`void` | `setPayload(Object payload)` Update the message payload.
`void` | `setProperty(String key, Object value)` Deprecated. use `setProperty(String, Object, org.mule.api.transport.PropertyScope)` or preferrably any of the scope-specific set methods.
`void` | `setProperty(String key, Object value, PropertyScope scope)` Set a property on the message.
`void` | `setReplyTo(Object replyTo)` Sets a replyTo address for this message.
`void` | `setSessionProperty(String key, Object value)`
`void` | `setStringProperty(String name, String value)` Deprecated. use `setOutboundProperty(String, Object)` instead

Method Detail

### addProperties

    @Deprecated
    void addProperties(Map<String,Object> properties)

  Deprecated. use `addProperties(java.util.Map, org.mule.api.transport.PropertyScope)` instead

  Adds a map of properties to be associated with this message

  Parameters:
    `properties` - the properties add to this message

### addProperties

    void addProperties(Map<String,Object> properties,
                       PropertyScope scope)

  Adds a map of properties to be associated with this message

  Parameters:
    `properties` - the properties add to this message
    `scope` - the scope in which the properties should be added

### clearProperties

    @Deprecated
    void clearProperties()

  Deprecated. use `clearProperties(org.mule.api.transport.PropertyScope)` instead

  Removes all properties on this message in the `PropertyScope.INVOCATION` and `PropertyScope.OUTBOUND`.

### clearProperties

    void clearProperties(PropertyScope scope)

  Removes all properties on this message in the given scope. Note that the INBOUND scope is read-only, so attempting to clear this scopee will result in an UnsupportedOperationException.

  Parameters:
    `scope` - the property scope to clear
  Throws:
    `UnsupportedOperationException` - if scope specified is `PropertyScope.INBOUND`

### getProperty

    @Deprecated
    Object getProperty(String key)

  Deprecated. use the overloaded version with an explicit lookup scope. This method will now use only the outbound scope.

  /**

  See Also:
    `getInboundProperty(String)`, `getOutboundProperty(String)`, `getInvocationProperty(String)`, `getSessionProperty(String)`

### setProperty

    @Deprecated
    void setProperty(String key,
                                Object value)

  Deprecated. use `setProperty(String, Object, org.mule.api.transport.PropertyScope)` or preferrably any of the scope-specific set methods.

  Set a property on the message. This method will now set a value on the outbound scope only.

  Parameters:
    `key` - the key on which to associate the value
    `value` - the property value
  See Also:
    `setInvocationProperty(String, Object)`, `setOutboundProperty(String, Object)`, `setSessionProperty(String, Object)`

### setInvocationProperty

    void setInvocationProperty(String key,
                               Object value)

  See Also:
    `setProperty(String, Object, org.mule.api.transport.PropertyScope)`

### setOutboundProperty

    void setOutboundProperty(String key,
                             Object value)

  See Also:
    `setProperty(String, Object, org.mule.api.transport.PropertyScope)`

### setProperty

    void setProperty(String key,
                     Object value,
                     PropertyScope scope)

  Set a property on the message. End-users should prefer more scope-specific methods for readability. This one is more intended for programmatic scope manipulation and Mule internal use.

  Parameters:
    `key` - the key on which to associate the value
    `value` - the property value
    `scope` - The scope at which to set the property at
  See Also:
    `PropertyScope`, `setInvocationProperty(String, Object)`, `setOutboundProperty(String, Object)`, `setSessionProperty(String, Object)`

### removeProperty

    @Deprecated
    Object removeProperty(String key)

  Deprecated. use `removeProperty(String, org.mule.api.transport.PropertyScope)`

  Removes a property on this message.

  Parameters:
    `key` - the property key to remove
  Returns:
    the removed property value or null if the property did not exist

### removeProperty

    Object removeProperty(String key,
                          PropertyScope scope)

  Removes a property on this message from the specified scope only.

  Parameters:
    `key` - the property key to remove
    `scope` - The scope at which to set the property at
  Returns:
    the removed property value or null if the property did not exist

### getPropertyNames

    @Deprecated
    Set<String> getPropertyNames()

  Deprecated. use `getPropertyNames(org.mule.api.transport.PropertyScope)`

  Returns:
    all property keys on this message.
  Since:
    3.0 only the outbound scope properties are returned

### getPropertyNames

    Set<String> getPropertyNames(PropertyScope scope)

  Gets all property names in a given scope. Prefer using one of the convenience scope-aware methods instead, this one is meant for internal access mostly.

  Parameters:
    `scope` - the scope of property names
  Returns:
    all property keys on this message in the given scope
  See Also:
    `getInvocationPropertyNames()`, `getInboundPropertyNames()`, `getOutboundPropertyNames()`, `getSessionPropertyNames()`

### getInvocationPropertyNames

    Set<String> getInvocationPropertyNames()

### getInboundPropertyNames

    Set<String> getInboundPropertyNames()

### getOutboundPropertyNames

    Set<String> getOutboundPropertyNames()

### getSessionPropertyNames

    Set<String> getSessionPropertyNames()

### getPayload

    Object getPayload()

  Returns:
    the current message

### getUniqueId

    String getUniqueId()

  gets the unique identifier for the message. It's up to the implementation to ensure a unique id

  Returns:
    a unique message id. The Id should never be null. If the underlying transport does not have the notion of a message Id, one should be generated. The generated Id should be a UUID.

### getProperty

    @Deprecated
    Object getProperty(String name,
                                  Object defaultValue)

  Deprecated. use scope-aware methods instead

  Gets a property from the message

  Parameters:
    `name` - the name or key of the property. This must be non-null.
    `defaultValue` - a default value if the property doesn't exist in the event. This can be null.
  Returns:
    the property value or the defaultValue if the property does not exist
  See Also:
    `getInboundProperty(String)`, `getOutboundProperty(String)`, `getInvocationProperty(String)`, `getSessionProperty(String)`

### getProperty

    <T> T getProperty(String name,
                      PropertyScope scope)

  Gets a property from the message with a given scope. End-users should prefer more scope-specific methods for readability. This one is more intended for programmatic scope manipulation and Mule internal use.

  Parameters:
    `name` - the name or key of the property. This must be non-null.
    `scope` - The scope of the property to retrieve. This must be non-null.
  Returns:
    the property value or null if the property does not exist in the specified scope
  See Also:
    `getInboundProperty(String)`, `getOutboundProperty(String)`, `getInvocationProperty(String)`, `getSessionProperty(String)`

### getInboundProperty

    <T> T getInboundProperty(String name,
                             T defaultValue)

  See Also:
    `getProperty(String, org.mule.api.transport.PropertyScope, Object)`

### getInboundProperty

    <T> T getInboundProperty(String name)

  See Also:
    `getProperty(String, org.mule.api.transport.PropertyScope, Object)`

### getInvocationProperty

    <T> T getInvocationProperty(String name,
                                T defaultValue)

  See Also:
    `getProperty(String, org.mule.api.transport.PropertyScope, Object)`

### getInvocationProperty

    <T> T getInvocationProperty(String name)

  See Also:
    `getProperty(String, org.mule.api.transport.PropertyScope, Object)`

### getOutboundProperty

    <T> T getOutboundProperty(String name,
                              T defaultValue)

  See Also:
    `getProperty(String, org.mule.api.transport.PropertyScope, Object)`

### getOutboundProperty

    <T> T getOutboundProperty(String name)

  See Also:
    `getProperty(String, org.mule.api.transport.PropertyScope, Object)`

### findPropertyInAnyScope

    <T> T findPropertyInAnyScope(String name,
                                 T defaultValue)

  This method was added with the introduction of Property scopes. However, this method should rarely be used. Instead, the scoped accessors should be used. Mule does not use this method internally and may be deprecated in future versions The Scopes will be checked in the following order, with the first match being returned -
  - Outbound
  - Invocation
  - Session
  - Inbound

  Type Parameters:
    `T` - The Type of the property value that will be returned
  Parameters:
    `name` - the name of the property to look for
    `defaultValue` - the default value that will be returned if the property is not found
  Returns:
    TThe property value from the first scope that had the property set, or the 'defaultValue' if the property was not found in any scope
  Since:
    3.0

### getProperty

    <T> T getProperty(String name,
                      PropertyScope scope,
                      T defaultValue)

  Gets a property from the message with a given scope and provides a default value if the property is not present on the message in the scope specified. The method will also type check against the default value to ensure that the value is of the correct type. If null is used for the default value no type checking is done.

  Type Parameters:
    `T` - the defaultValue type ,this is used to validate the property value type
  Parameters:
    `name` - the name or key of the property. This must be non-null.
    `scope` - The scope of the property to retrieve. This must be non-null.
    `defaultValue` - the value to return if the property is not in the scope provided. Can be null
  Returns:
    the property value or the defaultValue if the property does not exist in the specified scope
  Throws:
    `IllegalArgumentException` - if the value for the property key is not assignable from the defaultValue type

### getIntProperty

    @Deprecated
    int getIntProperty(String name,
                                  int defaultValue)

  Deprecated. use `getInboundProperty(String, Object)` instead

  Gets an integer property from the message

  Parameters:
    `name` - the name or key of the property
    `defaultValue` - a default value if the property doesn't exist in the event
  Returns:
    the property value or the defaultValue if the property does not exist

### getLongProperty

    @Deprecated
    long getLongProperty(String name,
                                    long defaultValue)

  Deprecated. use `getInboundProperty(String, Object)` instead

  Gets a long property from the message

  Parameters:
    `name` - the name or key of the property
    `defaultValue` - a default value if the property doesn't exist in the event
  Returns:
    the property value or the defaultValue if the property does not exist

### getDoubleProperty

    @Deprecated
    double getDoubleProperty(String name,
                                        double defaultValue)

  Deprecated. use `getInboundProperty(String, Object)` instead

  Gets a double property from the message

  Parameters:
    `name` - the name or key of the property
    `defaultValue` - a default value if the property doesn't exist in the event
  Returns:
    the property value or the defaultValue if the property does not exist

### getStringProperty

    @Deprecated
    String getStringProperty(String name,
                                        String defaultValue)

  Deprecated. use `getInboundProperty(String, Object)` instead

  Gets a String property from the message

  Parameters:
    `name` - the name or key of the property
    `defaultValue` - a default value if the property doesn't exist in the event
  Returns:
    the property value or the defaultValue if the property does not exist

### getBooleanProperty

    @Deprecated
    boolean getBooleanProperty(String name,
                                          boolean defaultValue)

  Deprecated. use `getInboundProperty(String, Object)` instead

  Gets a boolean property from the message

  Parameters:
    `name` - the name or key of the property
    `defaultValue` - a default value if the property doesn't exist in the event
  Returns:
    the property value or the defaultValue if the property does not exist

### setBooleanProperty

    @Deprecated
    void setBooleanProperty(String name,
                                       boolean value)

  Deprecated. use `setOutboundProperty(String, Object)` instead

  Sets a boolean property on the message

  Parameters:
    `name` - the property name or key
    `value` - the property value

### setIntProperty

    @Deprecated
    void setIntProperty(String name,
                                   int value)

  Deprecated. use `setOutboundProperty(String, Object)` instead

  Sets a integer property on the message

  Parameters:
    `name` - the property name or key
    `value` - the property value

### setLongProperty

    @Deprecated
    void setLongProperty(String name,
                                    long value)

  Deprecated. use `setOutboundProperty(String, Object)` instead

  Sets a long property on the message

  Parameters:
    `name` - the property name or key
    `value` - the property value

### setDoubleProperty

    @Deprecated
    void setDoubleProperty(String name,
                                      double value)

  Deprecated. use `setOutboundProperty(String, Object)` instead

  Sets a double property on the message

  Parameters:
    `name` - the property name or key
    `value` - the property value

### setStringProperty

    @Deprecated
    void setStringProperty(String name,
                                      String value)

  Deprecated. use `setOutboundProperty(String, Object)` instead

  Sets a String property on the message

  Parameters:
    `name` - the property name or key
    `value` - the property value

### setCorrelationId

    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

    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

### getCorrelationSequence

    int getCorrelationSequence()

  Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)

  Returns:
    the sequence number or -1 if the sequence is not important

### setCorrelationSequence

    void setCorrelationSequence(int sequence)

  Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)

  Parameters:
    `sequence` - the sequence number or -1 if the sequence is not important

### getCorrelationGroupSize

    int getCorrelationGroupSize()

  Determines how many messages are in the correlation group

  Returns:
    total messages in this group or -1 if the size is not known

### setCorrelationGroupSize

    void setCorrelationGroupSize(int size)

  Determines how many messages are in the correlation group

  Parameters:
    `size` - the total messages in this group or -1 if the size is not known

### setReplyTo

    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

    Object getReplyTo()

  Returns 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

### getExceptionPayload

    ExceptionPayload getExceptionPayload()

  If an error occurred during the processing of this message this will return a ErrorPayload that contains the root exception and Mule error code, plus any other releated info

  Returns:
    The exception payload (if any) attached to this message

### setExceptionPayload

    void setExceptionPayload(ExceptionPayload payload)

  If an error occurs while processing this message, a ErrorPayload is attached which contains the root exception and Mule error code, plus any other releated info.

  Parameters:
    `payload` - The exception payload to attach to this message

### addAttachment

    @Deprecated
    void addAttachment(String name,
                                  DataHandler dataHandler)
                       throws Exception

  Deprecated. use `#addOutboundAttachment(javax.activation.DataHandler)` instead

  Allows for arbitrary data attachments to be associated with the Message. These attachments work in the same way that email attachments work. Attachments can be binary or text

  Parameters:
    `name` - the name to associate with the attachment
    `dataHandler` - The attachment datahandler to use. This will be used to interact with the attachment data
  Throws:
    `Exception` - if the attachment cannot be added for any reason
  See Also:
    `DataHandler`

### addOutboundAttachment

    void addOutboundAttachment(String name,
                               DataHandler dataHandler)
                               throws Exception

  Allows for arbitrary data attachments to be associated with the Message. These attachments work in the same way that email attachments work. Attachments can be binary or text

  Parameters:
    `name` - the name to associate with the attachment
    `dataHandler` - The attachment `DataHandler` to use. This will be used to interact with the attachment data
  Throws:
    `Exception` - if the attachment cannot be added for any reason
  Since:
    3.0
  See Also:
    `DataHandler`

### addOutboundAttachment

    void addOutboundAttachment(String name,
                               Object object,
                               String contentType)
                               throws Exception

  Adds an outgoing attachment to the message

  Parameters:
    `object` - the input stream to the contents of the attachment. This object can either be a `URL`, which will construct a URL data source, or a `File`, which will construct a file data source. Any other object will be used as the raw contents of the attachment
    `contentType` - the content type of the attachment. Note that the charset attribute can be specifed too i.e. text/plain;charset=UTF-8
    `name` - the name to associate with the attachments
  Throws:
    `Exception` - if the attachment cannot be read or created
  Since:
    3.0

### removeAttachment

    @Deprecated
    void removeAttachment(String name)
                          throws Exception

  Deprecated. use `removeOutboundAttachment(java.lang.String)` instead

  Remove an attachment form this message with the specified name

  Parameters:
    `name` - the name of the attachment to remove. If the attachment does not exist, the request may be ignored
  Throws:
    `Exception` - different messaging systems handle attachments differently, as such some will throw an exception if an attachment does dot exist.

### removeOutboundAttachment

    void removeOutboundAttachment(String name)
                                  throws Exception

  Remove an attachment form this message with the specified name

  Parameters:
    `name` - the name of the attachment to remove. If the attachment does not exist, the request may be ignored
  Throws:
    `Exception` - different messaging systems handle attachments differently, as such some will throw an exception if an attachment does dot exist.
  Since:
    3.0

### getAttachment

    @Deprecated
    DataHandler getAttachment(String name)

  Deprecated. use `getInboundAttachment(String)` instead

  Retrieve an attachment with the given name. If the attachment does not exist, null will be returned

  Parameters:
    `name` - the name of the attachment to retrieve
  Returns:
    the attachment with the given name or null if the attachment does not exist
  See Also:
    `DataHandler`

### getInboundAttachment

    DataHandler getInboundAttachment(String name)

  Retrieve an attachment with the given name. If the attachment does not exist, null will be returned

  Parameters:
    `name` - the name of the attachment to retrieve
  Returns:
    the attachment with the given name or null if the attachment does not exist
  Since:
    3.0
  See Also:
    `DataHandler`

### getOutboundAttachment

    DataHandler getOutboundAttachment(String name)

  Retrieve an attachment with the given name. If the attachment does not exist, null will be returned

  Parameters:
    `name` - the name of the attachment to retrieve
  Returns:
    the attachment with the given name or null if the attachment does not exist
  Since:
    3.0
  See Also:
    `DataHandler`

### getAttachmentNames

    @Deprecated
    Set<String> getAttachmentNames()

  Deprecated. use `getInboundAttachmentNames()`

  Returns:
    a set of the names of the attachments on this message. If there are no attachments an empty set will be returned.

### getInboundAttachmentNames

    Set<String> getInboundAttachmentNames()

  Returns:
    a set of the names of the attachments on this message. If there are no attachments an empty set will be returned.
  Since:
    3.0

### getOutboundAttachmentNames

    Set<String> getOutboundAttachmentNames()

  Returns:
    a set of the names of the attachments on this message. If there are no attachments an empty set will be returned.
  Since:
    3.0

### getEncoding

    String getEncoding()

  Gets the encoding for the current message. For potocols that send encoding information with the message, this method should be overriden to expose the transport encoding, otherwise the default encoding in the Mule configuration will be used.

  Returns:
    the encoding for this message. This method must never return null

### setEncoding

    void setEncoding(String encoding)

  Sets the encoding for this message

  Parameters:
    `encoding` - the encoding to use

### release

    void release()

  Perform any clean up operations on the message resource. Typically this is used to esure that a message stream is closed

### applyTransformers

    void applyTransformers(MuleEvent event,
                           List<? extends Transformer> transformers)
                           throws MuleException

  Will apply a list of transformers to the payload of the message. This *Will* change the payload of the message. This method provides the only way to alter the paylaod of this message without recreating a copy of the message

  Parameters:
    `event` - the event being processed
    `transformers` - the transformers to apply to the message payload
  Throws:
    `TransformerException` - if a transformation error occurs or one or more of the transformers passed in a are incompatible with the message payload
    `MuleException`

### applyTransformers

    void applyTransformers(MuleEvent event,
                           Transformer... transformers)
                           throws MuleException

  Will apply a list of transformers to the payload of the message. This *Will* change the payload of the message. This method provides the only way to alter the paylaod of this message without recreating a copy of the message

  Parameters:
    `event` - the event being processed
    `transformers` - the transformers to apply to the message payload
  Throws:
    `TransformerException` - if a transformation error occurs or one or more of the transformers passed in a are incompatible with the message payload
    `MuleException`

### applyTransformers

    void applyTransformers(MuleEvent event,
                           List<? extends Transformer> transformers,
                           Class<?> outputType)
                           throws MuleException

  Will apply a list of transformers to the payload of the message. This *Will* change the payload of the message. This method provides the only way to alter the paylaod of this message without recreating a copy of the message

  Parameters:
    `event` - the event being processed
    `transformers` - the transformers to apply to the message payload
    `outputType` - the required output type for this transformation. by adding this parameter some additional transformations will occur on the message payload to ensure that the final payload is of the specified type. If no transformers can be found in the registry that can transform from the return type of the transformation list to the outputType and exception will be thrown
  Throws:
    `TransformerException` - if a transformation error occurs or one or more of the transformers passed in a are incompatible with the message payload
    `MuleException`

### setPayload

    void setPayload(Object payload)

  Update the message payload. This is typically only called if the payload was originally an InputStream. In which case, if the InputStream is consumed, it needs to be replaced for future access.

  Parameters:
    `payload` - the object to assign as the message payload

### getPayload

    <T> T getPayload(Class<T> outputType)
                 throws TransformerException

  Will attempt to obtain the payload of this message with the desired Class type. This will try and resolve a transformer that can do this transformation. If a transformer cannot be found an exception is thrown. Any transformers added to the registry will be checked for compatibility

  Parameters:
    `outputType` - the desired return type
  Returns:
    The converted payload of this message. Note that this method will not alter the payload of this message *unless* the payload is an InputStream in which case the stream will be read and the payload will become the fully read stream.
  Throws:
    `TransformerException` - if a transformer cannot be found or there is an error during transformation of the payload

### getPayload

    <T> T getPayload(DataType<T> outputType)
                 throws TransformerException

  Will attempt to obtain the payload of this message with the desired Class type. This will try and resolve a transformer that can do this transformation. If a transformer cannot be found an exception is thrown. Any transformers added to the registry will be checked for compatability

  Parameters:
    `outputType` - the desired return type
  Returns:
    The converted payload of this message. Note that this method will not alter the payload of this message *unless* the payload is an InputStream in which case the stream will be read and the payload will become the fully read stream.
  Throws:
    `TransformerException` - if a transformer cannot be found or there is an error during transformation of the payload

### getPayloadAsString

    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

### getPayloadAsString

    String getPayloadAsString()
                              throws Exception

  Converts the message implementation into a String representation. If encoding is required it will use the encoding set on the message

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

### getPayloadAsBytes

    byte[] getPayloadAsBytes()
                             throws Exception

  Converts the message implementation into a byte array representation

  Returns:
    byte array of the message
  Throws:
    `Exception` - Implemetation may throw an endpoint specific exception

### getOriginalPayload

    Object getOriginalPayload()

  Returns the original payload used to create this message. The payload of the message can change if `applyTransformers(MuleEvent,java.util.List)` or `applyTransformers(MuleEvent, java.util.List, Class)` is called.

  Returns:
    the original payload used to create this message

### getMuleContext

    MuleContext getMuleContext()

### getDataType

    DataType<?> getDataType()

  Returns the data type (if any) associated with the message's payload.

### getSessionProperty

    <T> T getSessionProperty(String name,
                             T defaultValue)

### getSessionProperty

    <T> T getSessionProperty(String name)

### setSessionProperty

    void setSessionProperty(String key,
                            Object value)

### createInboundMessage

    MuleMessage createInboundMessage()
                                     throws Exception

  Copy an inbound message to an outbound one, moving all message properties and attachments

  Returns:
    the inbound message
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.