|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MuleMessage
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(java.lang.String, 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 |
|
|
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()
|
|
|
getInboundProperty(String name)
|
|
|
getInboundProperty(String name,
T defaultValue)
|
|
Set<String> |
getInboundPropertyNames()
|
|
int |
getIntProperty(String name,
int defaultValue)
Deprecated. use getInboundProperty(String, Object) instead |
|
|
getInvocationProperty(String name)
|
|
|
getInvocationProperty(String name,
T defaultValue)
|
|
Set<String> |
getInvocationPropertyNames()
|
|
long |
getLongProperty(String name,
long defaultValue)
Deprecated. use getInboundProperty(String, Object) instead |
|
String |
getMessageRootId()
gets an identifier that is the same among parent and child messages |
|
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()
|
|
|
getOutboundProperty(String name)
|
|
|
getOutboundProperty(String name,
T defaultValue)
|
|
Set<String> |
getOutboundPropertyNames()
|
|
Object |
getPayload()
|
|
|
getPayload(Class<T> outputType)
Will attempt to obtain the payload of this message with the desired Class type. |
|
|
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 |
|
String |
getPayloadForLogging()
Get the message payload for logging without throwing exception Converts the message implementation into a String representation. |
|
String |
getPayloadForLogging(String encoding)
Get the message payload for logging without throwing exception 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 |
|
|
getProperty(String name,
PropertyScope scope)
Gets a property from the message with a given scope. |
|
|
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. |
|
|
getSessionProperty(String name)
Deprecated. use MuleSession.getProperty(String) |
|
|
getSessionProperty(String name,
T defaultValue)
Deprecated. use MuleSession.getProperty(String) |
|
Set<String> |
getSessionPropertyNames()
Deprecated. |
|
String |
getStringProperty(String name,
String defaultValue)
Deprecated. use getInboundProperty(String, Object) instead |
|
String |
getUniqueId()
gets the unique identifier for the message. |
|
void |
propagateRootId(MuleMessage parent)
copy the message root id from parent to child |
|
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 |
setMessageRootId(String rootId)
set the root ID for the message |
|
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)
Deprecated. use MuleSession.setProperty(String, Serializable) |
|
void |
setStringProperty(String name,
String value)
Deprecated. use setOutboundProperty(String, Object) instead |
Method Detail |
---|
@Deprecated void addProperties(Map<String,Object> properties)
addProperties(java.util.Map, org.mule.api.transport.PropertyScope)
instead
properties
- the properties add to this messagevoid addProperties(Map<String,Object> properties, PropertyScope scope)
properties
- the properties add to this messagescope
- the scope in which the properties should be added@Deprecated void clearProperties()
clearProperties(org.mule.api.transport.PropertyScope)
instead
PropertyScope.INVOCATION
and
PropertyScope.OUTBOUND
.
void clearProperties(PropertyScope scope)
scope
- the property scope to clear
UnsupportedOperationException
- if scope specified is PropertyScope.INBOUND
@Deprecated Object getProperty(String key)
getInboundProperty(String)
,
getOutboundProperty(String)
,
getInvocationProperty(String)
,
getSessionProperty(String)
@Deprecated void setProperty(String key, Object value)
setProperty(String, Object, org.mule.api.transport.PropertyScope)
or
preferrably any of the scope-specific set methods.
key
- the key on which to associate the valuevalue
- the property valuesetInvocationProperty(String, Object)
,
setOutboundProperty(String, Object)
,
setSessionProperty(String, Object)
void setInvocationProperty(String key, Object value)
setProperty(String, Object, org.mule.api.transport.PropertyScope)
void setOutboundProperty(String key, Object value)
setProperty(String, Object, org.mule.api.transport.PropertyScope)
void setProperty(String key, Object value, PropertyScope scope)
key
- the key on which to associate the valuevalue
- the property valuescope
- The scope at which to set the property atPropertyScope
,
setInvocationProperty(String, Object)
,
setOutboundProperty(String, Object)
,
setSessionProperty(String, Object)
@Deprecated Object removeProperty(String key)
removeProperty(String, org.mule.api.transport.PropertyScope)
key
- the property key to remove
Object removeProperty(String key, PropertyScope scope)
key
- the property key to removescope
- The scope at which to set the property at
@Deprecated Set<String> getPropertyNames()
getPropertyNames(org.mule.api.transport.PropertyScope)
Set<String> getPropertyNames(PropertyScope scope)
scope
- the scope of property names
getInvocationPropertyNames()
,
getInboundPropertyNames()
,
getOutboundPropertyNames()
,
getSessionPropertyNames()
Set<String> getInvocationPropertyNames()
Set<String> getInboundPropertyNames()
Set<String> getOutboundPropertyNames()
@Deprecated Set<String> getSessionPropertyNames()
Object getPayload()
String getUniqueId()
String getMessageRootId()
void setMessageRootId(String rootId)
void propagateRootId(MuleMessage parent)
@Deprecated Object getProperty(String name, Object defaultValue)
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.
getInboundProperty(String)
,
getOutboundProperty(String)
,
getInvocationProperty(String)
,
getSessionProperty(String)
<T> T getProperty(String name, PropertyScope scope)
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.
getInboundProperty(String)
,
getOutboundProperty(String)
,
getInvocationProperty(String)
,
getSessionProperty(String)
<T> T getInboundProperty(String name, T defaultValue)
getProperty(String, org.mule.api.transport.PropertyScope, Object)
<T> T getInboundProperty(String name)
getProperty(String, org.mule.api.transport.PropertyScope, Object)
<T> T getInvocationProperty(String name, T defaultValue)
getProperty(String, org.mule.api.transport.PropertyScope, Object)
<T> T getInvocationProperty(String name)
getProperty(String, org.mule.api.transport.PropertyScope, Object)
<T> T getOutboundProperty(String name, T defaultValue)
getProperty(String, org.mule.api.transport.PropertyScope, Object)
<T> T getOutboundProperty(String name)
getProperty(String, org.mule.api.transport.PropertyScope, Object)
<T> T findPropertyInAnyScope(String name, T defaultValue)
T
- The Type of the property value that will be returnedname
- the name of the property to look fordefaultValue
- the default value that will be returned if the property is not found
<T> T getProperty(String name, PropertyScope scope, T defaultValue)
T
- the defaultValue type ,this is used to validate the property value typename
- 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
IllegalArgumentException
- if the value for the property key is not assignable from the defaultValue type@Deprecated int getIntProperty(String name, int defaultValue)
getInboundProperty(String, Object)
instead
name
- the name or key of the propertydefaultValue
- a default value if the property doesn't exist in the event
@Deprecated long getLongProperty(String name, long defaultValue)
getInboundProperty(String, Object)
instead
name
- the name or key of the propertydefaultValue
- a default value if the property doesn't exist in the event
@Deprecated double getDoubleProperty(String name, double defaultValue)
getInboundProperty(String, Object)
instead
name
- the name or key of the propertydefaultValue
- a default value if the property doesn't exist in the event
@Deprecated String getStringProperty(String name, String defaultValue)
getInboundProperty(String, Object)
instead
name
- the name or key of the propertydefaultValue
- a default value if the property doesn't exist in the event
@Deprecated boolean getBooleanProperty(String name, boolean defaultValue)
getInboundProperty(String, Object)
instead
name
- the name or key of the propertydefaultValue
- a default value if the property doesn't exist in the event
@Deprecated void setBooleanProperty(String name, boolean value)
setOutboundProperty(String, Object)
instead
name
- the property name or keyvalue
- the property value@Deprecated void setIntProperty(String name, int value)
setOutboundProperty(String, Object)
instead
name
- the property name or keyvalue
- the property value@Deprecated void setLongProperty(String name, long value)
setOutboundProperty(String, Object)
instead
name
- the property name or keyvalue
- the property value@Deprecated void setDoubleProperty(String name, double value)
setOutboundProperty(String, Object)
instead
name
- the property name or keyvalue
- the property value@Deprecated void setStringProperty(String name, String value)
setOutboundProperty(String, Object)
instead
name
- the property name or keyvalue
- the property valuevoid setCorrelationId(String id)
id
- the Id reference for this relationshipString getCorrelationId()
int getCorrelationSequence()
void setCorrelationSequence(int sequence)
sequence
- the sequence number or -1 if the sequence is not importantint getCorrelationGroupSize()
void setCorrelationGroupSize(int size)
size
- the total messages in this group or -1 if the size is not knownvoid setReplyTo(Object replyTo)
replyTo
- the endpointUri url to reply toObject getReplyTo()
ExceptionPayload getExceptionPayload()
void setExceptionPayload(ExceptionPayload payload)
payload
- The exception payload to attach to this message@Deprecated void addAttachment(String name, DataHandler dataHandler) throws Exception
addOutboundAttachment(java.lang.String, javax.activation.DataHandler)
instead
name
- the name to associate with the attachmentdataHandler
- The attachment datahandler to use. This will be used to
interact with the attachment data.
Exception
- if the attachment cannot be added for any reasonDataHandler
void addOutboundAttachment(String name, DataHandler dataHandler) throws Exception
name
- the name to associate with the attachmentdataHandler
- The attachment DataHandler
to use. This will be used to interact with the attachment data
Exception
- if the attachment cannot be added for any reasonDataHandler
void addOutboundAttachment(String name, Object object, String contentType) throws Exception
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 attachmentcontentType
- the content type of the attachment. Note that the charset attribute can be specifed too i.e. text/plain;charset=UTF-8name
- the name to associate with the attachments
Exception
- if the attachment cannot be read or created@Deprecated void removeAttachment(String name) throws Exception
removeOutboundAttachment(java.lang.String)
instead
name
- the name of the attachment to remove. If the attachment does not exist, the request may be ignored
Exception
- different messaging systems handle attachments differently, as such some will throw an exception
if an attachment does dot exist.void removeOutboundAttachment(String name) throws Exception
name
- the name of the attachment to remove. If the attachment does not exist, the request may be ignored
Exception
- different messaging systems handle attachments differently, as such some will throw an exception
if an attachment does dot exist.@Deprecated DataHandler getAttachment(String name)
getInboundAttachment(String)
instead
name
- the name of the attachment to retrieve
DataHandler
DataHandler getInboundAttachment(String name)
name
- the name of the attachment to retrieve
DataHandler
DataHandler getOutboundAttachment(String name)
name
- the name of the attachment to retrieve
DataHandler
@Deprecated Set<String> getAttachmentNames()
getInboundAttachmentNames()
Set<String> getInboundAttachmentNames()
Set<String> getOutboundAttachmentNames()
String getEncoding()
void setEncoding(String encoding)
encoding
- the encoding to usevoid release()
void applyTransformers(MuleEvent event, List<? extends Transformer> transformers) throws MuleException
event
- the event being processedtransformers
- the transformers to apply to the message payload
TransformerException
- if a transformation error occurs or one or more of the transformers passed in a
are incompatible with the message payload
MuleException
void applyTransformers(MuleEvent event, Transformer... transformers) throws MuleException
event
- the event being processedtransformers
- the transformers to apply to the message payload
TransformerException
- if a transformation error occurs or one or more of the transformers passed in a
are incompatible with the message payload
MuleException
void applyTransformers(MuleEvent event, List<? extends Transformer> transformers, Class<?> outputType) throws MuleException
event
- the event being processedtransformers
- the transformers to apply to the message payloadoutputType
- 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
TransformerException
- if a transformation error occurs or one or more of the transformers passed in a
are incompatible with the message payload
MuleException
void setPayload(Object payload)
payload
- the object to assign as the message payload<T> T getPayload(Class<T> outputType) throws TransformerException
outputType
- the desired return type
TransformerException
- if a transformer cannot be found or there is an error during transformation of the
payload<T> T getPayload(DataType<T> outputType) throws TransformerException
outputType
- the desired return type
TransformerException
- if a transformer cannot be found or there is an error during transformation of the
payloadString getPayloadAsString(String encoding) throws Exception
encoding
- The encoding to use when transforming the message (if
necessary). The parameter is used when converting from a byte array
Exception
- Implementation may throw an endpoint specific exceptionString getPayloadAsString() throws Exception
Exception
- Implementation may throw an endpoint specific exceptionbyte[] getPayloadAsBytes() throws Exception
Exception
- Implemetation may throw an endpoint specific exceptionObject getOriginalPayload()
applyTransformers(MuleEvent,java.util.List)
or
applyTransformers(MuleEvent, java.util.List, Class)
is called.
String getPayloadForLogging()
String getPayloadForLogging(String encoding)
MuleContext getMuleContext()
DataType<?> getDataType()
@Deprecated <T> T getSessionProperty(String name, T defaultValue)
MuleSession.getProperty(String)
@Deprecated <T> T getSessionProperty(String name)
MuleSession.getProperty(String)
@Deprecated void setSessionProperty(String key, Object value)
MuleSession.setProperty(String, Serializable)
MuleMessage createInboundMessage() throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |