public static class DefaultEventBuilder.EventImplementation extends Object implements Event, DeserializationPostInitialisable
EventImplementation represents any data event occurring in the Mule environment. All data sent or received
within the Mule environment will be passed between components as an MuleEvent.
The Event holds some data and provides helper methods for obtaining the data in a format that the receiving Mule
component understands. The event can also maintain any number of flowVariables that can be set and retrieved by Mule
components.
Event.Builder, Event.CurrentEventHolderDeserializationPostInitialisable.Implementation| Modifier and Type | Method and Description |
|---|---|
EventContext |
getContext() |
String |
getCorrelationId()
The returned value will depend on the
MessageSource that created this event, and the flow that is executing the
event. |
Optional<org.mule.runtime.api.message.Error> |
getError()
When a mule component throws an error then an
Error object gets generated with all the data associated to the error. |
FlowCallStack |
getFlowCallStack()
Events have a stack of executed flows (same as a call stack), so that at any given instant an application developer can
determine where this event came from.
|
FlowConstruct |
getFlowConstruct()
Retrieves the service for the current event
|
GroupCorrelation |
getGroupCorrelation()
Returns the correlation metadata of this message.
|
String |
getLegacyCorrelationId()
Deprecated.
Transport infrastructure is deprecated.
|
org.mule.runtime.api.message.Message |
getMessage()
Returns the message payload for this event
|
byte[] |
getMessageAsBytes(MuleContext muleContext)
Returns the contents of the message as a byte array.
|
String |
getMessageAsString(Charset encoding,
MuleContext muleContext)
Returns the message contents for logging
|
String |
getMessageAsString(MuleContext muleContext)
Returns the message contents as a string If necessary this will use the encoding set on the event
|
MuleContext |
getMuleContext()
Returns the muleContext for the Mule node that this event was received in
|
Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> |
getParameters()
Returns the complete set of parameters in the current event
|
Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> |
getProperties()
Returns the complete set of properties in the current event
|
Object |
getReplyToDestination()
Return the destination (if any) that will be passed to the reply-to handler.
|
ReplyToHandler |
getReplyToHandler()
Return the replyToHandler (if any) that will be used to perform async reply
|
SecurityContext |
getSecurityContext()
The security context for this session.
|
MuleSession |
getSession()
Retrieves the service session for the current event
|
<T> org.mule.runtime.api.metadata.TypedValue<T> |
getVariable(String key)
Returns the variable registered under the given
key |
Set<String> |
getVariableNames()
Returns an immutable
Set of variable names. |
boolean |
isNotificationsEnabled()
Indicates if notifications should be fired when processing this message.
|
String |
toString() |
<T> T |
transformMessage(Class<T> outputType,
MuleContext muleContext)
Transforms the message into the requested format.
|
Object |
transformMessage(org.mule.runtime.api.metadata.DataType outputType,
MuleContext muleContext)
Transforms the message into the requested format.
|
String |
transformMessageToString(MuleContext muleContext)
Returns the message transformed into it's recognised or expected format and then into a String.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbuilder, builder, builder, getCurrentEvent, getVariableValueOrNull, setCurrentEventpublic EventContext getContext()
getContext in interface EventEvent from a MessageSource.public org.mule.runtime.api.message.Message getMessage()
EventgetMessage in interface Eventpublic Optional<org.mule.runtime.api.message.Error> getError()
EventError object gets generated with all the data associated to the error.
This field will only contain a value within the error handler defined to handle errors. After the error handler is executed
the event error field will be cleared. If another flow is called from within the error handler the flow will still have
access to the error field.
To avoid losing the error field after the error handler the user can define a variable pointing to the error field.public byte[] getMessageAsBytes(MuleContext muleContext) throws DefaultMuleException
EventgetMessageAsBytes in interface EventmuleContext - the Mule node.DefaultMuleExceptionpublic <T> T transformMessage(Class<T> outputType, MuleContext muleContext) throws TransformerException
EventtransformMessage in interface EventoutputType - The requested output type.muleContext - the Mule node.TransformerException - if a failure occurs in the transformerif the transform fails or the outputtype is nullpublic Object transformMessage(org.mule.runtime.api.metadata.DataType outputType, MuleContext muleContext) throws TransformerException
EventtransformMessage in interface EventoutputType - The requested output type.muleContext - the Mule node.TransformerException - if a failure occurs in the transformerif the transform fails or the outputtype is nullpublic String transformMessageToString(MuleContext muleContext) throws TransformerException
transformMessageToString in interface EventmuleContext - the Mule node.TransformerException - if a failure occurs in the transformerTransformerpublic String getMessageAsString(MuleContext muleContext) throws org.mule.runtime.api.exception.MuleException
EventgetMessageAsString in interface EventmuleContext - the Mule node.org.mule.runtime.api.exception.MuleException - if the message cannot be converted into a stringpublic String getMessageAsString(Charset encoding, MuleContext muleContext) throws org.mule.runtime.api.exception.MuleException
getMessageAsString in interface Eventencoding - the encoding to use when converting bytes to a string, if necessarymuleContext - the Mule node.org.mule.runtime.api.exception.MuleException - if the message cannot be converted into a stringpublic MuleSession getSession()
EventgetSession in interface Eventpublic FlowConstruct getFlowConstruct()
EventgetFlowConstruct in interface Eventpublic MuleContext getMuleContext()
EventgetMuleContext in interface Eventpublic ReplyToHandler getReplyToHandler()
EventgetReplyToHandler in interface Eventpublic Object getReplyToDestination()
EventgetReplyToDestination in interface Eventpublic Set<String> getVariableNames()
EventSet of variable names.getVariableNames in interface Eventpublic <T> org.mule.runtime.api.metadata.TypedValue<T> getVariable(String key)
EventkeygetVariable in interface EventT - the type of the variable value.key - the name or key of the variable. This must be non-null.TypedValue containing the variable's value and DataTypepublic Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> getProperties()
EventgetProperties in interface EventMap containing the properties' name as key and the TypedValue as valuepublic Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> getParameters()
EventgetParameters in interface EventMap containing the parameters' name as key and the TypedValue as valuepublic boolean isNotificationsEnabled()
EventisNotificationsEnabled in interface Eventpublic FlowCallStack getFlowCallStack()
Event
This will only be enabled if DefaultMuleConfiguration.isFlowTrace() is true. If false, the stack will
always be empty.
getFlowCallStack in interface Eventpublic SecurityContext getSecurityContext()
EventgetSecurityContext in interface Eventpublic GroupCorrelation getGroupCorrelation()
EventGroupCorrelation.getGroupCorrelation in interface Eventpublic String getCorrelationId()
EventMessageSource that created this event, and the flow that is executing the
event.getCorrelationId in interface Event@Deprecated public String getLegacyCorrelationId()
getLegacyCorrelationId in interface Eventnull.Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.