|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.DefaultMuleEventContext
public class DefaultMuleEventContext
DefaultMuleEventContext is the context object for the current request.
Using the context, developers can send/dispatch/receive events programmatically as
well as manage transactions.
| Field Summary | |
|---|---|
protected static Log |
logger
logger used by this class |
| Constructor Summary | |
|---|---|
DefaultMuleEventContext(MuleEvent event)
|
|
| Method Summary | |
|---|---|
void |
dispatchEvent(MuleMessage message)
This will dispatch an event asynchronously via the configured outbound endpoint on the service for this session |
void |
dispatchEvent(MuleMessage message,
EndpointURI endpointUri)
Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpointUri configured for the event |
void |
dispatchEvent(MuleMessage message,
OutboundEndpoint endpoint)
Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event |
void |
dispatchEvent(MuleMessage message,
String endpointName)
Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event |
void |
dispatchEvent(Object message)
This will dispatch an event asynchronously via the configured outbound endpoint on the service for this session |
Transaction |
getCurrentTransaction()
Returns the current transaction (if any) for the session |
String |
getEncoding()
Gets the encoding for the current message. |
EndpointURI |
getEndpointURI()
Returns a reference to the Endpoint Uri for this context This is the endpoint on which the event was received |
MuleMessage |
getMessage()
Returns the message payload for this event |
byte[] |
getMessageAsBytes()
Reterns the conents of the message as a byte array. |
String |
getMessageAsString()
Returns the message contents as a string This method will use the default encoding 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. |
Service |
getService()
|
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()
Determines whether the default processing for this event will be executed. |
boolean |
isSynchronous()
Determines whether the was sent synchrounously or not |
void |
markTransactionForRollback()
Mark the current transaction (if any) for rollback |
MuleMessage |
requestEvent(EndpointURI endpointUri,
long timeout)
Requests a synchronous receive of an event on the service |
MuleMessage |
requestEvent(InboundEndpoint endpoint,
long timeout)
Requests a synchronous receive of an event on the service |
MuleMessage |
requestEvent(String endpointName,
long timeout)
Requests a synchronous receive of an event on the service |
MuleMessage |
sendEvent(MuleMessage message)
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,
EndpointURI endpointUri)
Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpointUri configured for the event |
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)
This will send an event via the configured outbound router on the service |
FutureMessageResult |
sendEventAsync(MuleMessage message,
EndpointURI endpointUri,
int timeout)
sends an event request via the configured outbound router for this service. |
FutureMessageResult |
sendEventAsync(MuleMessage message,
int timeout)
sends an event request via the configured outbound router for this service. |
FutureMessageResult |
sendEventAsync(MuleMessage message,
String endpointName,
int timeout)
sends an event request via the configured outbound router for this service. |
FutureMessageResult |
sendEventAsync(Object message,
int timeout)
sends an event request via the configured outbound router for this service. |
void |
setStopFurtherProcessing(boolean stopFurtherProcessing)
Determines whether the default processing for this event will be executed. |
String |
toString()
|
Object |
transformMessage()
Returns the message transformed into it's recognised or expected format. |
Object |
transformMessage(Class expectedType)
Returns the message transformed into its recognised or expected format. |
byte[] |
transformMessageToBytes()
Returns the message transformed into it's recognised or expected format and then into an array of bytes. |
String |
transformMessageToString()
Returns the message transformed into it's recognised or expected format and then into a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Log logger
| Constructor Detail |
|---|
public DefaultMuleEventContext(MuleEvent event)
| Method Detail |
|---|
public MuleMessage getMessage()
getMessage in interface MuleEventContext
public byte[] getMessageAsBytes()
throws MuleException
getMessageAsBytes in interface MuleEventContextMuleException - if the message cannot be converted into an
array of bytes
public Object transformMessage()
throws TransformerException
transformMessage in interface MuleEventContextTransformerException - if a failure occurs in
the transformerTransformer
public Object transformMessage(Class expectedType)
throws TransformerException
transformMessage in interface MuleEventContextexpectedType - The class type required for the return object. This param
just provides a convienient way to manage type casting of
transformed objects
TransformerException - if a failure occurs or
if the return type is not the same as the expected type in the
transformerTransformer
public byte[] transformMessageToBytes()
throws TransformerException
transformMessageToBytes in interface MuleEventContextTransformerException - if a failure occurs in
the transformerTransformer
public String getMessageAsString(String encoding)
throws MuleException
getMessageAsString in interface MuleEventContextencoding - The encoding to use when transforming the message
MuleException - if the message cannot be converted into a
string
public String transformMessageToString()
throws TransformerException
transformMessageToString in interface MuleEventContextTransformerException - if a failure occurs in
the transformerTransformer
public String getMessageAsString()
throws MuleException
getMessageAsString in interface MuleEventContextMuleException - if the message cannot be converted into a
stringpublic Transaction getCurrentTransaction()
getCurrentTransaction in interface MuleEventContext
public void markTransactionForRollback()
throws TransactionException
MuleEventContext
markTransactionForRollback in interface MuleEventContextTransactionException - if operation failed
public MuleMessage sendEvent(Object message)
throws MuleException
sendEvent in interface MuleEventContextmessage - the message to send
MuleException - if there is no outbound endpoint configured
on the service or the events fails during dispatch
public MuleMessage sendEvent(MuleMessage message,
OutboundEndpoint endpoint)
throws MuleException
sendEvent in interface MuleEventContextmessage - 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
public MuleMessage sendEvent(MuleMessage message)
throws MuleException
sendEvent in interface MuleEventContextmessage - the message payload to send
MuleException - if the event fails to be processed by the
service or the transport for the endpoint
public MuleMessage sendEvent(MuleMessage message,
EndpointURI endpointUri)
throws MuleException
sendEvent in interface MuleEventContextmessage - the event message payload to sendendpointUri - The endpointUri to disptch the event through
MuleException - if the event fails to be processed by the
service or the transport for the endpointUri
public FutureMessageResult sendEventAsync(Object message,
int timeout)
throws MuleException
sendEventAsync in interface MuleEventContextmessage - the object that is the payload of the eventtimeout - how long to block in milliseconds waiting for a result
MuleException - if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public FutureMessageResult sendEventAsync(MuleMessage message,
int timeout)
throws MuleException
sendEventAsync in interface MuleEventContextmessage - the MuleMessage of the eventtimeout - how long to block in milliseconds waiting for a result
MuleException - if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public FutureMessageResult sendEventAsync(MuleMessage message,
EndpointURI endpointUri,
int timeout)
throws MuleException
sendEventAsync in interface MuleEventContextmessage - the MuleMessage of the eventendpointUri - the endpointUri to dispatch totimeout - how long to block in milliseconds waiting for a result
MuleException - if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public FutureMessageResult sendEventAsync(MuleMessage message,
String endpointName,
int timeout)
throws MuleException
sendEventAsync in interface MuleEventContextmessage - 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 result
MuleException - if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public MuleMessage sendEvent(MuleMessage message,
String endpointName)
throws MuleException
sendEvent in interface MuleEventContextmessage - 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 configuration
MuleException - if the event fails to be processed by the
service or the transport for the endpoint
public void dispatchEvent(Object message)
throws MuleException
dispatchEvent in interface MuleEventContextmessage - payload to dispatch
MuleException - if there is no outbound endpoint configured
on the service or the events fails during dispatch
public void dispatchEvent(MuleMessage message)
throws MuleException
dispatchEvent in interface MuleEventContextmessage - the message to send
MuleException - if there is no outbound endpoint configured
on the service or the events fails during dispatch
public void dispatchEvent(MuleMessage message,
EndpointURI endpointUri)
throws MuleException
dispatchEvent in interface MuleEventContextmessage - the event message payload to sendendpointUri - the endpointUri to dispatc the event to first on the
service configuration and then on the mule manager configuration
MuleException - if the event fails to be processed by the
service or the transport for the endpointUri
public void dispatchEvent(MuleMessage message,
String endpointName)
throws MuleException
dispatchEvent in interface MuleEventContextmessage - 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 configuration
MuleException - if the event fails to be processed by the
service or the transport for the endpoint
public void dispatchEvent(MuleMessage message,
OutboundEndpoint endpoint)
throws MuleException
dispatchEvent in interface MuleEventContextmessage - 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
public MuleMessage requestEvent(InboundEndpoint endpoint,
long timeout)
throws MuleException
requestEvent in interface MuleEventContextendpoint - the endpoint identifing the endpointUri on ewhich the event
will be receivedtimeout - time in milliseconds before the request timesout
MuleException - if the request operation fails
public MuleMessage requestEvent(String endpointName,
long timeout)
throws MuleException
requestEvent in interface MuleEventContextendpointName - the endpoint identifing the endpointUri on ewhich the
event will be receivedtimeout - time in milliseconds before the request timesout
MuleException - if the request operation fails
public MuleMessage requestEvent(EndpointURI endpointUri,
long timeout)
throws MuleException
requestEvent in interface MuleEventContextendpointUri - the endpointUri on which the event will be receivedtimeout - time in milliseconds before the request timesout
MuleException - if the request operation failspublic Service getService()
getService in interface MuleEventContextpublic 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
dispatched.
isStopFurtherProcessing in interface MuleEventContextMuleEventContext,
Callablepublic void setStopFurtherProcessing(boolean stopFurtherProcessing)
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.
setStopFurtherProcessing in interface MuleEventContextstopFurtherProcessing - the value to set.public OutputStream getOutputStream()
getOutputStream in interface MuleEventContextpublic boolean isSynchronous()
isSynchronous in interface MuleEventContextpublic EndpointURI getEndpointURI()
MuleEventContext
getEndpointURI in interface MuleEventContextpublic Transaction getTransaction()
getTransaction in interface MuleEventContextpublic int getTimeout()
getTimeout in interface MuleEventContextpublic String getEncoding()
getEncoding in interface MuleEventContextpublic MuleSession getSession()
getSession in interface MuleEventContextpublic String toString()
toString in class Objectpublic MuleContext getMuleContext()
getMuleContext in interface MuleEventContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||