org.mule.umo
Interface UMOEventContext

All Known Implementing Classes:
MuleEventContext

public interface UMOEventContext

UMOEventContext is the context object for the current request. Using the context, developers can send/dispatch/receive events programmatically as well as manage transactions.


Method Summary
 void dispatchEvent(Object payload)
          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 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
 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()
          Returns the contents of the message as a byte array.
 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
 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 it's 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 endpoint, 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 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
 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 endpoint, 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.
 

Method Detail

getMessage

UMOMessage getMessage()
Returns the message payload for this event

Returns:
the message payload for this event

getMessageAsBytes

byte[] getMessageAsBytes()
                         throws UMOException
Returns the contents of the message as a byte array.

Returns:
the contents of the message as a byte array
Throws:
UMOException - if the message cannot be converted into an array of bytes

getTransformedMessage

Object getTransformedMessage()
                             throws TransformerException
Returns the message transformed into it's recognised or expected format. The transformer used is the one configured on the endpoint through which this event was received.

Returns:
the message transformed into it's recognised or expected format.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getTransformedMessage

Object getTransformedMessage(Class expectedType)
                             throws TransformerException
Returns the message transformed into it's recognised or expected format. The transformer used is the one configured on the endpoint through which this event was received.

Parameters:
expectedType - The class type required for the return object. This param just provides a convienient way to manage type casting of transformed objects
Returns:
the message transformed into it's recognised or expected format.
Throws:
TransformerException - if a failure occurs or if the return type is not the same as the expected type in the transformer
See Also:
UMOTransformer

getTransformedMessageAsBytes

byte[] getTransformedMessageAsBytes()
                                    throws TransformerException
Returns the message transformed into it's recognised or expected format and then into an array of bytes. The transformer used is the one configured on the endpoint through which this event was received.

Returns:
the message transformed into it's recognised or expected format as an array of bytes.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getTransformedMessageAsString

String getTransformedMessageAsString()
                                     throws TransformerException
Returns the message transformed into it's recognised or expected format and then into a String. The transformer used is the one configured on the endpoint through which this event was received. This method will use the encoding set on the event

Returns:
the message transformed into it's recognised or expected format as a Strings.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getMessageAsString

String getMessageAsString()
                          throws UMOException
Returns the message contents as a string This method will use the encoding set on the event

Returns:
the message contents as a string
Throws:
UMOException - if the message cannot be converted into a string

getTransformedMessageAsString

String getTransformedMessageAsString(String encoding)
                                     throws TransformerException
Returns the message transformed into it's recognised or expected format and then into a String. The transformer used is the one configured on the endpoint through which this event was received.

Parameters:
encoding - The encoding to use when transforming the message
Returns:
the message transformed into it's recognised or expected format as a Strings.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getMessageAsString

String getMessageAsString(String encoding)
                          throws UMOException
Returns the message contents as a string

Parameters:
encoding - The encoding to use when transforming the message
Returns:
the message contents as a string
Throws:
UMOException - if the message cannot be converted into a string

getCurrentTransaction

UMOTransaction getCurrentTransaction()
Returns the current transaction (if any) for the session

Returns:
the current transaction for the session or null if there is no transaction in progress

markTransactionForRollback

void markTransactionForRollback()
                                throws TransactionException
Mark the current transaction (if any) for rollback

Throws:
TransactionException

sendEvent

UMOMessage sendEvent(Object message)
                     throws UMOException
This will send an event via the configured outbound router on the component

Parameters:
message - the message to send
Returns:
the result of the send if any
Throws:
UMOException - if there is no outbound endpoint configured on the component or the events fails during dispatch

sendEvent

UMOMessage sendEvent(UMOMessage message)
                     throws UMOException
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

Parameters:
message - the message payload to send
Returns:
the return Message from the call or null if there was no result
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

sendEvent

UMOMessage sendEvent(UMOMessage message,
                     UMOEndpointURI endpoint)
                     throws UMOException
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

Parameters:
message - the event message payload to send
endpoint - The endpointUri to disptch the event through
Returns:
the return Message from the call or null if there was no result
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

sendEvent

UMOMessage sendEvent(UMOMessage message,
                     String endpointName)
                     throws UMOException
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

Parameters:
message - the event message payload to send
endpointName - 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
Returns:
the return Message from the call or null if there was no result
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

sendEvent

UMOMessage sendEvent(UMOMessage message,
                     UMOEndpoint endpoint)
                     throws UMOException
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

Parameters:
message - the event message payload to send
endpoint - The endpoint to disptch the event through.
Returns:
the return Message from the call or null if there was no result
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

sendEventAsync

FutureMessageResult sendEventAsync(Object message,
                                   int timeout)
                                   throws UMOException
sends an event request via the configured outbound router for this component. This method return immediately, but the result of the event invocation available from the returned a Future result that can be accessed later by the the returned FutureMessageResult. the Future messageResult can be queried at any time to check that the invocation has completed. A timeout is associated with the invocation, which is the maximum time in milli-seconds that the invocation should take to complete

Parameters:
message - the object that is the payload of the event
timeout - how long to block in milliseconds waiting for a result
Returns:
the result message if any of the invocation
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found
See Also:
FutureMessageResult

sendEventAsync

FutureMessageResult sendEventAsync(UMOMessage message,
                                   int timeout)
                                   throws UMOException
sends an event request via the configured outbound router for this component. This method return immediately, but the result of the event invocation available from the returned a Future result that can be accessed later by the the returned FutureMessageResult. the Future messageResult can be queried at any time to check that the invocation has completed. A timeout is associated with the invocation, which is the maximum time in milli-seconds that the invocation should take to complete

Parameters:
message - the UMOMessage of the event
timeout - how long to block in milliseconds waiting for a result
Returns:
the result message if any of the invocation
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found
See Also:
FutureMessageResult

sendEventAsync

FutureMessageResult sendEventAsync(UMOMessage message,
                                   UMOEndpointURI endpoint,
                                   int timeout)
                                   throws UMOException
sends an event request via the configured outbound router for this component. This method return immediately, but the result of the event invocation available from the returned a Future result that can be accessed later by the the returned FutureMessageResult. the Future messageResult can be queried at any time to check that the invocation has completed. A timeout is associated with the invocation, which is the maximum time in milli-seconds that the invocation should take to complete

Parameters:
message - the UMOMessage of the event
endpoint - the endpointUri to dispatch to
timeout - how long to block in milliseconds waiting for a result
Returns:
the result message if any of the invocation
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found
See Also:
FutureMessageResult

sendEventAsync

FutureMessageResult sendEventAsync(UMOMessage message,
                                   String endpointName,
                                   int timeout)
                                   throws UMOException
sends an event request via the configured outbound router for this component. This method return immediately, but the result of the event invocation available from the returned a Future result that can be accessed later by the the returned FutureMessageResult. the Future messageResult can be queried at any time to check that the invocation has completed. A timeout is associated with the invocation, which is the maximum time in milli-seconds that the invocation should take to complete

Parameters:
message - the UMOMessage of the event
endpointName - 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
timeout - how long to block in milliseconds waiting for a result
Returns:
the result message if any of the invocation
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found
See Also:
FutureMessageResult

dispatchEvent

void dispatchEvent(UMOMessage message)
                   throws UMOException
This will dispatch an event asynchronously via the configured outbound endpoint on the component for this session

Parameters:
message - the message to send
Throws:
UMOException - if there is no outbound endpoint configured on the component or the events fails during dispatch

dispatchEvent

void dispatchEvent(Object payload)
                   throws UMOException
This will dispatch an event asynchronously via the configured outbound endpoint on the component for this session

Parameters:
payload - the message payloadto send
Throws:
UMOException - if there is no outbound endpoint configured on the component or the events fails during dispatch

dispatchEvent

void dispatchEvent(UMOMessage message,
                   UMOEndpointURI endpoint)
                   throws UMOException
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

Parameters:
message - the event message payload to send
endpoint - the endpointUri to dispatc the event to first on the component configuration and then on the mule manager configuration
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

dispatchEvent

void dispatchEvent(UMOMessage message,
                   String endpointName)
                   throws UMOException
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.

Parameters:
message - the event message payload to send
endpointName - 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
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

dispatchEvent

void dispatchEvent(UMOMessage message,
                   UMOEndpoint endpoint)
                   throws UMOException
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

Parameters:
message - the event message payload to send
endpoint - The endpoint name to disptch the event through.
Throws:
UMOException - if the event fails to be processed by the component or the transport for the endpoint

receiveEvent

UMOMessage receiveEvent(UMOEndpoint endpoint,
                        long timeout)
                        throws UMOException
Requests a synchronous receive of an event on the component.

Parameters:
endpoint - the endpoint identifying the endpointUri on which the event will be received
timeout - time in milliseconds before the request times out
Returns:
The requested event or null if the request times out
Throws:
UMOException - if the request operation fails

receiveEvent

UMOMessage receiveEvent(String endpointName,
                        long timeout)
                        throws UMOException
Requests a synchronous receive of an event on the component.

Parameters:
endpointName - the endpoint identifying the endpointUri on which the event will be received
timeout - time in milliseconds before the request timesout
Returns:
The requested event or null if the request times out
Throws:
UMOException - if the request operation fails

receiveEvent

UMOMessage receiveEvent(UMOEndpointURI endpoint,
                        long timeout)
                        throws UMOException
Requests a synchronous receive of an event on the component.

Parameters:
endpoint - the endpointUri on which the event will be received
timeout - time in milliseconds before the request timesout
Returns:
The requested event or null if the request times out
Throws:
UMOException - if the request operation fails

getComponentDescriptor

UMODescriptor getComponentDescriptor()

isStopFurtherProcessing

boolean isStopFurtherProcessing()
Determines whether the default processing for this event will be executed. By default, the Mule server will route events according to a components configuration. The user can override this behaviour by obtaining a reference to the Event context, either by implementing 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.

Returns:
Returns true is the user has set stopFurtherProcessing.
See Also:
UMOManager, UMOEventContext, Callable

setStopFurtherProcessing

void setStopFurtherProcessing(boolean stopFurtherProcessing)
Determines whether the default processing for this event will be executed. By default, the Mule server will route events according to a components configuration. The user can override this behaviour by obtaining a reference to the Event context, either by implementing 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.

Parameters:
stopFurtherProcessing - the value to set.

getOutputStream

OutputStream getOutputStream()
An outputstream the can optionally be used write response data to an incoming message.

Returns:
an output strem if one has been made available by the message receiver that received the message

isSynchronous

boolean isSynchronous()
Determines whether the was sent synchrounously or not

Returns:
true if the event is synchronous

getEndpointURI

UMOEndpointURI getEndpointURI()
Returns a reference to the Endpoint Uri for this context This is the endpoint on which the event was received

Returns:
the receive endpoint for this event context

getTransaction

UMOTransaction getTransaction()
Returns the transaction for the current event or null if there is no transaction in progresss

Returns:
the transaction for the current event or null if there is no transaction in progresss

getTimeout

int getTimeout()
Get the timeout value associated with the event

Returns:
the timeout for the event

isStreaming

boolean isStreaming()
Determines whether the event flow is being streamed

Returns:
true if the request should be streamed

getEncoding

String getEncoding()
Gets the encoding for the current message. For potocols that send encoding Information with the message, this method should be overriden to expose the transport encoding, otherwise the default encoding in the Mule configuration will be used

Returns:
the encoding for this message. This method must never return null

getSession

UMOSession getSession()


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.