|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.impl.MuleEventContext
public class 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.
Field Summary | |
---|---|
protected static Log |
logger
logger used by this class |
Method Summary | |
---|---|
void |
dispatchEvent(Object message)
This will dispatch an event asynchronously via the configured outbound endpoint on the component for this session |
void |
dispatchEvent(UMOMessage message)
This will dispatch an event asynchronously via the configured outbound endpoint on the component for this session |
void |
dispatchEvent(UMOMessage message,
String endpointName)
Depending on the session state this methods either Passes an event asynchronously to the next available Mule UMO in the pool or via the endpoint configured for the event |
void |
dispatchEvent(UMOMessage message,
UMOEndpoint endpoint)
Depending on the session state this methods either Passes an event asynchronously to the next available Mule UMO in the pool or via the endpoint configured for the event |
void |
dispatchEvent(UMOMessage message,
UMOEndpointURI endpointUri)
Depending on the session state this methods either Passes an event asynchronously to the next available Mule UMO in the pool or via the endpointUri configured for the event |
UMODescriptor |
getComponentDescriptor()
|
UMOTransaction |
getCurrentTransaction()
Returns the current transaction (if any) for the session |
String |
getEncoding()
Gets the encoding for the current message. |
UMOEndpointURI |
getEndpointURI()
Returns a reference to the Endpoint Uri for this context This is the endpoint on which the event was received |
UMOMessage |
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 |
OutputStream |
getOutputStream()
An outputstream the can optionally be used write response data to an incoming message. |
UMOSession |
getSession()
|
int |
getTimeout()
Get the timeout value associated with the event |
UMOTransaction |
getTransaction()
Returns the transaction for the current event or null if there is no transaction in progresss |
Object |
getTransformedMessage()
Returns the message transformed into it's recognised or expected format. |
Object |
getTransformedMessage(Class expectedType)
Returns the message transformed into its recognised or expected format. |
byte[] |
getTransformedMessageAsBytes()
Returns the message transformed into it's recognised or expected format and then into an array of bytes. |
String |
getTransformedMessageAsString()
Returns the message transformed into it's recognised or expected format and then into a String. |
String |
getTransformedMessageAsString(String encoding)
Returns the message transformed into it's recognised or expected format and then into a String. |
boolean |
isStopFurtherProcessing()
Determines whether the default processing for this event will be executed. |
boolean |
isStreaming()
Determines whether the event flow is being streamed |
boolean |
isSynchronous()
Determines whether the was sent synchrounously or not |
void |
markTransactionForRollback()
Mark the current transaction (if any) for rollback |
UMOMessage |
receiveEvent(String endpointName,
long timeout)
Requests a synchronous receive of an event on the component |
UMOMessage |
receiveEvent(UMOEndpoint endpoint,
long timeout)
Requests a synchronous receive of an event on the component |
UMOMessage |
receiveEvent(UMOEndpointURI endpointUri,
long timeout)
Requests a synchronous receive of an event on the component |
UMOMessage |
sendEvent(Object message)
This will send an event via the configured outbound router on the component |
UMOMessage |
sendEvent(UMOMessage message)
Depending on the session state this methods either Passes an event synchronously to the next available Mule UMO in the pool or via the endpoint configured for the event |
UMOMessage |
sendEvent(UMOMessage message,
String endpointName)
Depending on the session state this methods either Passes an event synchronously to the next available Mule UMO in the pool or via the endpoint configured for the event |
UMOMessage |
sendEvent(UMOMessage message,
UMOEndpoint endpoint)
Depending on the session state this methods either Passes an event synchronously to the next available Mule UMO in the pool or via the endpoint configured for the event |
UMOMessage |
sendEvent(UMOMessage message,
UMOEndpointURI endpointUri)
Depending on the session state this methods either Passes an event synchronously to the next available Mule UMO in the pool or via the endpointUri configured for the event |
FutureMessageResult |
sendEventAsync(Object message,
int timeout)
sends an event request via the configured outbound router for this component. |
FutureMessageResult |
sendEventAsync(UMOMessage message,
int timeout)
sends an event request via the configured outbound router for this component. |
FutureMessageResult |
sendEventAsync(UMOMessage message,
String endpointName,
int timeout)
sends an event request via the configured outbound router for this component. |
FutureMessageResult |
sendEventAsync(UMOMessage message,
UMOEndpointURI endpointUri,
int timeout)
sends an event request via the configured outbound router for this component. |
void |
setStopFurtherProcessing(boolean stopFurtherProcessing)
Determines whether the default processing for this event will be executed. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final Log logger
Method Detail |
---|
public UMOMessage getMessage()
getMessage
in interface UMOEventContext
public byte[] getMessageAsBytes() throws UMOException
getMessageAsBytes
in interface UMOEventContext
UMOException
- if the message cannot be converted into an
array of bytespublic Object getTransformedMessage() throws TransformerException
getTransformedMessage
in interface UMOEventContext
TransformerException
- if a failure occurs in
the transformerUMOTransformer
public Object getTransformedMessage(Class expectedType) throws TransformerException
getTransformedMessage
in interface UMOEventContext
expectedType
- 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
transformerUMOTransformer
public byte[] getTransformedMessageAsBytes() throws TransformerException
getTransformedMessageAsBytes
in interface UMOEventContext
TransformerException
- if a failure occurs in
the transformerUMOTransformer
public String getTransformedMessageAsString(String encoding) throws TransformerException
getTransformedMessageAsString
in interface UMOEventContext
encoding
- The encoding to use when transforming the message
TransformerException
- if a failure occurs in
the transformerUMOTransformer
public String getMessageAsString(String encoding) throws UMOException
getMessageAsString
in interface UMOEventContext
encoding
- The encoding to use when transforming the message
UMOException
- if the message cannot be converted into a
stringpublic String getTransformedMessageAsString() throws TransformerException
getTransformedMessageAsString
in interface UMOEventContext
TransformerException
- if a failure occurs in
the transformerUMOTransformer
public String getMessageAsString() throws UMOException
getMessageAsString
in interface UMOEventContext
UMOException
- if the message cannot be converted into a
stringpublic UMOTransaction getCurrentTransaction()
getCurrentTransaction
in interface UMOEventContext
public void markTransactionForRollback() throws TransactionException
UMOEventContext
markTransactionForRollback
in interface UMOEventContext
TransactionException
public UMOMessage sendEvent(Object message) throws UMOException
sendEvent
in interface UMOEventContext
message
- the message to send
UMOException
- if there is no outbound endpoint configured
on the component or the events fails during dispatchpublic UMOMessage sendEvent(UMOMessage message, UMOEndpoint endpoint) throws UMOException
sendEvent
in interface UMOEventContext
message
- the event message payload to sendendpoint
- The endpoint to disptch the event through.
UMOException
- if the event fails to be processed by the
component or the transport for the endpointpublic UMOMessage sendEvent(UMOMessage message) throws UMOException
sendEvent
in interface UMOEventContext
message
- the message payload to send
UMOException
- if the event fails to be processed by the
component or the transport for the endpointpublic UMOMessage sendEvent(UMOMessage message, UMOEndpointURI endpointUri) throws UMOException
sendEvent
in interface UMOEventContext
message
- the event message payload to sendendpointUri
- The endpointUri to disptch the event through
UMOException
- if the event fails to be processed by the
component or the transport for the endpointUripublic FutureMessageResult sendEventAsync(Object message, int timeout) throws UMOException
sendEventAsync
in interface UMOEventContext
message
- the object that is the payload of the eventtimeout
- how long to block in milliseconds waiting for a result
UMOException
- if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public FutureMessageResult sendEventAsync(UMOMessage message, int timeout) throws UMOException
sendEventAsync
in interface UMOEventContext
message
- the UMOMessage of the eventtimeout
- how long to block in milliseconds waiting for a result
UMOException
- if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public FutureMessageResult sendEventAsync(UMOMessage message, UMOEndpointURI endpointUri, int timeout) throws UMOException
sendEventAsync
in interface UMOEventContext
message
- the UMOMessage of the eventendpointUri
- the endpointUri to dispatch totimeout
- how long to block in milliseconds waiting for a result
UMOException
- if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public FutureMessageResult sendEventAsync(UMOMessage message, String endpointName, int timeout) throws UMOException
sendEventAsync
in interface UMOEventContext
message
- the UMOMessage of the eventendpointName
- The endpoint name to disptch the event through. This will
be looked up first on the component configuration and then on the
mule manager configurationtimeout
- how long to block in milliseconds waiting for a result
UMOException
- if the dispatch fails or the components or
transfromers cannot be foundFutureMessageResult
public UMOMessage sendEvent(UMOMessage message, String endpointName) throws UMOException
sendEvent
in interface UMOEventContext
message
- the event message payload to sendendpointName
- The endpoint name to disptch the event through. This will
be looked up first on the component configuration and then on the
mule manager configuration
UMOException
- if the event fails to be processed by the
component or the transport for the endpointpublic void dispatchEvent(Object message) throws UMOException
dispatchEvent
in interface UMOEventContext
message
- payload to dispatch
UMOException
- if there is no outbound endpoint configured
on the component or the events fails during dispatchpublic void dispatchEvent(UMOMessage message) throws UMOException
dispatchEvent
in interface UMOEventContext
message
- the message to send
UMOException
- if there is no outbound endpoint configured
on the component or the events fails during dispatchpublic void dispatchEvent(UMOMessage message, UMOEndpointURI endpointUri) throws UMOException
dispatchEvent
in interface UMOEventContext
message
- the event message payload to sendendpointUri
- the endpointUri to dispatc the event to first on the
component configuration and then on the mule manager configuration
UMOException
- if the event fails to be processed by the
component or the transport for the endpointUripublic void dispatchEvent(UMOMessage message, String endpointName) throws UMOException
dispatchEvent
in interface UMOEventContext
message
- the event message payload to sendendpointName
- The endpoint name to disptch the event through. This will
be looked up first on the component configuration and then on the
mule manager configuration
UMOException
- if the event fails to be processed by the
component or the transport for the endpointpublic void dispatchEvent(UMOMessage message, UMOEndpoint endpoint) throws UMOException
dispatchEvent
in interface UMOEventContext
message
- the event message payload to sendendpoint
- The endpoint name to disptch the event through.
UMOException
- if the event fails to be processed by the
component or the transport for the endpointpublic UMOMessage receiveEvent(UMOEndpoint endpoint, long timeout) throws UMOException
receiveEvent
in interface UMOEventContext
endpoint
- the endpoint identifing the endpointUri on ewhich the event
will be receivedtimeout
- time in milliseconds before the request timesout
UMOException
- if the request operation failspublic UMOMessage receiveEvent(String endpointName, long timeout) throws UMOException
receiveEvent
in interface UMOEventContext
endpointName
- the endpoint identifing the endpointUri on ewhich the
event will be receivedtimeout
- time in milliseconds before the request timesout
UMOException
- if the request operation failspublic UMOMessage receiveEvent(UMOEndpointURI endpointUri, long timeout) throws UMOException
receiveEvent
in interface UMOEventContext
endpointUri
- the endpointUri on which the event will be receivedtimeout
- time in milliseconds before the request timesout
UMOException
- if the request operation failspublic UMODescriptor getComponentDescriptor()
getComponentDescriptor
in interface UMOEventContext
public boolean isStopFurtherProcessing()
org.mule.umo.lifecycle.Callable
or calling
RequestContext.getEventContext
to obtain the UMOEventContext for
the current thread. The user can programmatically control how events are
dispatched.
isStopFurtherProcessing
in interface UMOEventContext
UMOManager
,
UMOEventContext
,
Callable
public void setStopFurtherProcessing(boolean stopFurtherProcessing)
org.mule.umo.lifecycle.Callable
or calling
UMOManager.getEventContext
to obtain the UMOEventContext for
the current thread. The user can programmatically control how events are
dispached.
setStopFurtherProcessing
in interface UMOEventContext
stopFurtherProcessing
- the value to set.public OutputStream getOutputStream()
getOutputStream
in interface UMOEventContext
public boolean isSynchronous()
isSynchronous
in interface UMOEventContext
public UMOEndpointURI getEndpointURI()
UMOEventContext
getEndpointURI
in interface UMOEventContext
public UMOTransaction getTransaction()
getTransaction
in interface UMOEventContext
public int getTimeout()
getTimeout
in interface UMOEventContext
public boolean isStreaming()
isStreaming
in interface UMOEventContext
public String getEncoding()
getEncoding
in interface UMOEventContext
public UMOSession getSession()
getSession
in interface UMOEventContext
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |