public interface MuleEventContext
MuleEventContext
is the context object for the current request.
Using the context, developers can send/dispatch/receive events programmatically as
well as manage transactions.Modifier and Type | Method and Description |
---|---|
void |
dispatchEvent(MuleMessage message)
Deprecated.
|
void |
dispatchEvent(MuleMessage message,
EndpointURI endpoint)
Deprecated.
|
void |
dispatchEvent(MuleMessage message,
OutboundEndpoint endpoint)
Deprecated.
|
void |
dispatchEvent(MuleMessage message,
String endpointName)
Deprecated.
|
void |
dispatchEvent(Object payload)
Deprecated.
|
Transaction |
getCurrentTransaction()
Returns the current transaction (if any) for the session
|
String |
getEncoding()
Gets the encoding for the current message.
|
URI |
getEndpointURI()
Returns a reference to the Endpoint Uri for this context This is the endpoint
on which the event was received
|
MessageExchangePattern |
getExchangePattern() |
FlowConstruct |
getFlowConstruct() |
MuleMessage |
getMessage()
Returns the message payload for this event
|
byte[] |
getMessageAsBytes()
Deprecated.
Use
getMessage().getPayload(DataType.BYTE_ARRAY_DATA_TYPE) |
String |
getMessageAsString()
Returns the message contents as a string This method will use the encoding set
on the event
|
String |
getMessageAsString(String encoding)
Returns the message contents as a string
|
MuleContext |
getMuleContext() |
OutputStream |
getOutputStream()
An outputstream the can optionally be used write response data to an incoming
message.
|
MuleSession |
getSession() |
int |
getTimeout()
Get the timeout value associated with the event
|
Transaction |
getTransaction()
Returns the transaction for the current event or null if there is no
transaction in progresss
|
boolean |
isStopFurtherProcessing()
Deprecated.
|
void |
markTransactionForRollback()
Deprecated.
|
MuleMessage |
requestEvent(EndpointURI endpoint,
long timeout)
Deprecated.
|
MuleMessage |
requestEvent(InboundEndpoint endpoint,
long timeout)
Deprecated.
|
MuleMessage |
requestEvent(String endpointName,
long timeout)
Requests a synchronous receive of an event on the service.
|
MuleMessage |
sendEvent(MuleMessage message)
Deprecated.
|
MuleMessage |
sendEvent(MuleMessage message,
EndpointURI endpoint)
Deprecated.
|
MuleMessage |
sendEvent(MuleMessage message,
OutboundEndpoint endpoint)
Depending on the session state this methods either Passes an event
synchronously to the next available Mule component in the pool or via the endpoint
configured for the event
|
MuleMessage |
sendEvent(MuleMessage message,
String endpointName)
Depending on the session state this methods either Passes an event
synchronously to the next available Mule component in the pool or via the endpoint
configured for the event
|
MuleMessage |
sendEvent(Object message)
Deprecated.
|
FutureMessageResult |
sendEventAsync(MuleMessage message,
EndpointURI endpoint,
int timeout)
Deprecated.
|
FutureMessageResult |
sendEventAsync(MuleMessage message,
int timeout)
Deprecated.
|
FutureMessageResult |
sendEventAsync(MuleMessage message,
String endpointName,
int timeout)
Deprecated.
|
FutureMessageResult |
sendEventAsync(Object message,
int timeout)
Deprecated.
|
void |
setStopFurtherProcessing(boolean stopFurtherProcessing)
Determines whether the default processing for this event will be executed.
|
Object |
transformMessage(Class expectedType)
Returns the message transformed into it's recognised or expected format.
|
Object |
transformMessage(DataType dataType)
Returns the message transformed into its recognised or expected format.
|
byte[] |
transformMessageToBytes()
Deprecated.
|
String |
transformMessageToString()
Returns the message transformed into it's recognised or expected format and
then into a String.
|
MuleMessage getMessage()
@Deprecated byte[] getMessageAsBytes() throws MuleException
getMessage().getPayload(DataType.BYTE_ARRAY_DATA_TYPE)
MuleException
- if the message cannot be converted into an array of bytesObject transformMessage(DataType dataType) throws TransformerException
dataType
- The dataType required for the return object. This param
just provides a convienient way to manage type casting of
transformed objectsTransformerException
- if a failure occurs or
if the return type is not the same as the expected type in the
transformerTransformer
Object transformMessage(Class expectedType) throws TransformerException
expectedType
- The class type required for the return object. This param
just provides a convienient way to manage type casting of
transformed objectsTransformerException
- if a failure occurs or
if the return type is not the same as the expected type in the
transformerTransformer
@Deprecated byte[] transformMessageToBytes() throws TransformerException
transformMessage(org.mule.api.transformer.DataType)
insteadTransformerException
- if a failure occurs in the transformerTransformer
String transformMessageToString() throws TransformerException
TransformerException
- if a failure occurs in the transformerTransformer
String getMessageAsString() throws MuleException
MuleException
- if the message cannot be converted into a stringString getMessageAsString(String encoding) throws MuleException
encoding
- The encoding to use when transforming the messageMuleException
- if the message cannot be converted into a stringTransaction getCurrentTransaction()
@Deprecated void markTransactionForRollback() throws TransactionException
TransactionException
- if operation failed@Deprecated MuleMessage sendEvent(Object message) throws MuleException
message
- the message to sendMuleException
- if there is no outbound endpoint configured on the
service or the events fails during dispatch@Deprecated MuleMessage sendEvent(MuleMessage message) throws MuleException
message
- the message payload to sendMuleException
- if the event fails to be processed by the service or
the transport for the endpoint@Deprecated MuleMessage sendEvent(MuleMessage message, EndpointURI endpoint) throws MuleException
message
- the event message payload to sendendpoint
- The endpointUri to disptch the event throughMuleException
- if the event fails to be processed by the service or
the transport for the endpointMuleMessage sendEvent(MuleMessage message, String endpointName) throws MuleException
message
- the event message payload to sendendpointName
- The endpoint name to disptch the event through. This will
be looked up first on the service configuration and then on the
mule manager configurationMuleException
- if the event fails to be processed by the service or
the transport for the endpointMuleMessage sendEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException
message
- the event message payload to sendendpoint
- The endpoint to disptch the event through.MuleException
- if the event fails to be processed by the service or
the transport for the endpoint@Deprecated FutureMessageResult sendEventAsync(Object message, int timeout) throws MuleException
message
- the object that is the payload of the eventtimeout
- how long to block in milliseconds waiting for a resultMuleException
- if the dispatch fails or the components or
transfromers cannot be foundDeprecated from 3.6.0 - Only supported with Services. To invoke a flow directly you need to invoke
the {@link org.mule.construct.Flow#process(MuleEvent)} method once you have obtained the flow instance from the
{@link org.mule.api.registry.MuleRegistry}.
@Deprecated FutureMessageResult sendEventAsync(MuleMessage message, int timeout) throws MuleException
message
- the MuleMessage of the eventtimeout
- how long to block in milliseconds waiting for a resultMuleException
- if the dispatch fails or the components or
transfromers cannot be foundDeprecated from 3.6.0 - Only supported with Services. To invoke a flow directly you need to invoke
the {@link org.mule.construct.Flow#process(MuleEvent)} method once you have obtained the flow instance from the
{@link org.mule.api.registry.MuleRegistry}.
@Deprecated FutureMessageResult sendEventAsync(MuleMessage message, EndpointURI endpoint, int timeout) throws MuleException
message
- the MuleMessage of the eventendpoint
- the endpointUri to dispatch totimeout
- how long to block in milliseconds waiting for a resultMuleException
- if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
@Deprecated FutureMessageResult sendEventAsync(MuleMessage message, String endpointName, int timeout) throws MuleException
message
- the MuleMessage of the eventendpointName
- The endpoint name to disptch the event through. This will
be looked up first on the service configuration and then on the
mule manager configurationtimeout
- how long to block in milliseconds waiting for a resultMuleException
- if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
@Deprecated void dispatchEvent(MuleMessage message) throws MuleException
message
- the message to sendMuleException
- if there is no outbound endpoint configured on the
service or the events fails during dispatch
Deprecated from 3.6.0 - Only supported with Services. To invoke a flow directly you need to invoke
the Flow.process(MuleEvent)
method once you have obtained the flow instance from the
MuleRegistry
.@Deprecated void dispatchEvent(Object payload) throws MuleException
payload
- the message payloadto sendMuleException
- if there is no outbound endpoint configured on the
service or the events fails during dispatch
Deprecated from 3.6.0 - Only supported with Services. To invoke a flow directly you need to invoke
the Flow.process(MuleEvent)
method once you have obtained the flow instance from the
MuleRegistry
.@Deprecated void dispatchEvent(MuleMessage message, EndpointURI endpoint) throws MuleException
message
- the event message payload to sendendpoint
- the endpointUri to dispatc the event to first on the service
configuration and then on the mule manager configurationMuleException
- if the event fails to be processed by the service or
the transport for the endpoint
Deprecated from 3.6.0 - Only supported with Services. To invoke a flow directly you need to invoke
the Flow.process(MuleEvent)
method once you have obtained the flow instance from the
MuleRegistry
.@Deprecated void dispatchEvent(MuleMessage message, String endpointName) throws MuleException
message
- the event message payload to sendendpointName
- The endpoint name to disptch the event through. This will
be looked up first on the service configuration and then on the
mule manager configurationMuleException
- if the event fails to be processed by the service or
the transport for the endpoint@Deprecated void dispatchEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException
message
- the event message payload to sendendpoint
- The endpoint name to disptch the event through.MuleException
- if the event fails to be processed by the service or
the transport for the endpoint@Deprecated MuleMessage requestEvent(InboundEndpoint endpoint, long timeout) throws MuleException
endpoint
- the endpoint identifying the endpointUri on which the event
will be receivedtimeout
- time in milliseconds before the request times outMuleException
- if the request operation failsMuleMessage requestEvent(String endpointName, long timeout) throws MuleException
endpointName
- the endpoint identifying the endpointUri on which the
event will be receivedtimeout
- time in milliseconds before the request timesoutMuleException
- if the request operation fails@Deprecated MuleMessage requestEvent(EndpointURI endpoint, long timeout) throws MuleException
endpoint
- the endpointUri on which the event will be receivedtimeout
- time in milliseconds before the request timesoutMuleException
- if the request operation fails
Deprecated from 3.6.0 - Only supported with Services. To invoke a flow directly you need to invoke
the Flow.process(MuleEvent)
method once you have obtained the flow instance from the
MuleRegistry
.FlowConstruct getFlowConstruct()
@Deprecated boolean isStopFurtherProcessing()
org.mule.api.lifecycle.Callable
or calling
RequestContext.getEventContext
to obtain the MuleEventContext for
the current thread. The user can programmatically control how events are
dispached.MuleContext
,
MuleEventContext
,
Callable
void setStopFurtherProcessing(boolean stopFurtherProcessing)
org.mule.api.lifecycle.Callable
or calling
UMOManager.getEventContext
to obtain the MuleEventContext for
the current thread. The user can programmatically control how events are
dispached.stopFurtherProcessing
- the value to set.OutputStream getOutputStream()
MessageExchangePattern getExchangePattern()
URI getEndpointURI()
Transaction getTransaction()
int getTimeout()
String getEncoding()
MuleSession getSession()
MuleContext getMuleContext()
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.