|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.mule.impl.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 |
boolean |
getBooleanProperty(String name,
boolean defaultValue)
Gets a Boolean property associated with the current event. |
UMODescriptor |
getComponentDescriptor()
|
UMOTransaction |
getCurrentTransaction()
Returns the current transaction (if any) for the session |
double |
getDoubleProperty(String name,
double defaultValue)
Gets a Double property associated with the current event. |
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 |
int |
getIntProperty(String name,
int defaultValue)
Gets an Integer property associated with the current event. |
long |
getLongProperty(String name,
long defaultValue)
Gets a Long property associated with the current event. |
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. |
Object |
getProperty(String name)
Gets a property associated with the current event. |
Object |
getProperty(String name,
Object defaultValue)
Gets a property associated with the current event. |
UMOSession |
getSession()
|
String |
getStringProperty(String name)
Gets a property associated with the current event. |
String |
getStringProperty(String name,
String defaultValue)
Gets a String property associated with the current event. |
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 |
setBooleanProperty(String name,
boolean value)
Sets a Boolean property associated with the current event. |
void |
setDoubleProperty(String name,
double value)
Sets a Double property associated with the current event. |
void |
setIntProperty(String name,
int value)
Sets an Integer property associated with the current event. |
void |
setLongProperty(String name,
long value)
Sets a Long property associated with the current event. |
void |
setProperty(String name,
Object value)
Sets a property associated with the current event. |
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 UMOEventContextUMOException - if the message cannot be converted into an
array of bytes
public Object getTransformedMessage()
throws TransformerException
getTransformedMessage in interface UMOEventContextTransformerException - if a failure occurs in
the transformerUMOTransformer
public Object getTransformedMessage(Class expectedType)
throws TransformerException
getTransformedMessage in interface UMOEventContextexpectedType - 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 UMOEventContextTransformerException - if a failure occurs in
the transformerUMOTransformer
public String getTransformedMessageAsString(String encoding)
throws TransformerException
getTransformedMessageAsString in interface UMOEventContextencoding - 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 UMOEventContextencoding - The encoding to use when transforming the message
UMOException - if the message cannot be converted into a
string
public String getTransformedMessageAsString()
throws TransformerException
getTransformedMessageAsString in interface UMOEventContextTransformerException - if a failure occurs in
the transformerUMOTransformer
public String getMessageAsString()
throws UMOException
getMessageAsString in interface UMOEventContextUMOException - if the message cannot be converted into a
stringpublic UMOTransaction getCurrentTransaction()
getCurrentTransaction in interface UMOEventContext
public void markTransactionForRollback()
throws TransactionException
UMOEventContext
markTransactionForRollback in interface UMOEventContextTransactionException
public UMOMessage sendEvent(Object message)
throws UMOException
sendEvent in interface UMOEventContextmessage - the message to send
UMOException - if there is no outbound endpoint configured
on the component or the events fails during dispatch
public UMOMessage sendEvent(UMOMessage message,
UMOEndpoint endpoint)
throws UMOException
sendEvent in interface UMOEventContextmessage - 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 endpoint
public UMOMessage sendEvent(UMOMessage message)
throws UMOException
sendEvent in interface UMOEventContextmessage - the message payload to send
UMOException - if the event fails to be processed by the
component or the transport for the endpoint
public UMOMessage sendEvent(UMOMessage message,
UMOEndpointURI endpointUri)
throws UMOException
sendEvent in interface UMOEventContextmessage - 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 endpointUri
public FutureMessageResult sendEventAsync(Object message,
int timeout)
throws UMOException
sendEventAsync in interface UMOEventContextmessage - 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 UMOEventContextmessage - 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 UMOEventContextmessage - 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 UMOEventContextmessage - 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 UMOEventContextmessage - 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 endpoint
public void dispatchEvent(Object message)
throws UMOException
dispatchEvent in interface UMOEventContextmessage - payload to dispatch
UMOException - if there is no outbound endpoint configured
on the component or the events fails during dispatch
public void dispatchEvent(UMOMessage message)
throws UMOException
dispatchEvent in interface UMOEventContextmessage - the message to send
UMOException - if there is no outbound endpoint configured
on the component or the events fails during dispatch
public void dispatchEvent(UMOMessage message,
UMOEndpointURI endpointUri)
throws UMOException
dispatchEvent in interface UMOEventContextmessage - 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 endpointUri
public void dispatchEvent(UMOMessage message,
String endpointName)
throws UMOException
dispatchEvent in interface UMOEventContextmessage - 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 endpoint
public void dispatchEvent(UMOMessage message,
UMOEndpoint endpoint)
throws UMOException
dispatchEvent in interface UMOEventContextmessage - 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 endpoint
public UMOMessage receiveEvent(UMOEndpoint endpoint,
long timeout)
throws UMOException
receiveEvent in interface UMOEventContextendpoint - the endpoint identifing the endpointUri on ewhich the event
will be receivedtimeout - time in milliseconds before the request timesout
UMOException - if the request operation fails
public UMOMessage receiveEvent(String endpointName,
long timeout)
throws UMOException
receiveEvent in interface UMOEventContextendpointName - the endpoint identifing the endpointUri on ewhich the
event will be receivedtimeout - time in milliseconds before the request timesout
UMOException - if the request operation fails
public UMOMessage receiveEvent(UMOEndpointURI endpointUri,
long timeout)
throws UMOException
receiveEvent in interface UMOEventContextendpointUri - 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 UMOEventContextpublic Object getProperty(String name)
event.getMessage().getProperty(...)
getProperty in interface UMOEventContextname - the property name
public Object getProperty(String name,
Object defaultValue)
event.getMessage().getProperty(..., ...)
getProperty in interface UMOEventContextname - the property namedefaultValue - a default value if the property doesn't exist in the event
public int getIntProperty(String name,
int defaultValue)
event.getMessage().getIntProperty(..., ...)
getIntProperty in interface UMOEventContextname - the property namedefaultValue - a default value if the property doesn't exist in the event
public long getLongProperty(String name,
long defaultValue)
event.getMessage().getLongProperty(..., ...)
getLongProperty in interface UMOEventContextname - the property namedefaultValue - a default value if the property doesn't exist in the event
public double getDoubleProperty(String name,
double defaultValue)
event.getMessage().getDoubleProperty(..., ...)
getDoubleProperty in interface UMOEventContextname - the property namedefaultValue - a default value if the property doesn't exist in the event
public boolean getBooleanProperty(String name,
boolean defaultValue)
event.getMessage().getbooleanProperty(..., ...)
getBooleanProperty in interface UMOEventContextname - the property namedefaultValue - a default value if the property doesn't exist in the event
public void setProperty(String name,
Object value)
event.getMessage().setProperty(..., ...)
setProperty in interface UMOEventContextname - the property name or keyvalue - the property value
public void setBooleanProperty(String name,
boolean value)
event.getMessage().setBooleanProperty(..., ...)
setBooleanProperty in interface UMOEventContextname - the property name or keyvalue - the property value
public void setIntProperty(String name,
int value)
event.getMessage().setIntProperty(..., ...)
setIntProperty in interface UMOEventContextname - the property name or keyvalue - the property value
public void setLongProperty(String name,
long value)
event.getMessage().setLongProperty(..., ...)
setLongProperty in interface UMOEventContextname - the property name or keyvalue - the property value
public void setDoubleProperty(String name,
double value)
event.getMessage().setDoubleProperty(..., ...)
setDoubleProperty in interface UMOEventContextname - the property name or keyvalue - the property valuepublic boolean isStopFurtherProcessing()
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.
isStopFurtherProcessing in interface UMOEventContextUMOManager,
UMOEventContext,
Callablepublic 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 UMOEventContextstopFurtherProcessing - the value to set.public OutputStream getOutputStream()
getOutputStream in interface UMOEventContextpublic boolean isSynchronous()
isSynchronous in interface UMOEventContextpublic UMOEndpointURI getEndpointURI()
UMOEventContext
getEndpointURI in interface UMOEventContextpublic UMOTransaction getTransaction()
getTransaction in interface UMOEventContextpublic int getTimeout()
getTimeout in interface UMOEventContextpublic String getStringProperty(String name)
UMOEventContextevent.getMessage().getProperty(...) This
will convert the returned value into a string
getStringProperty in interface UMOEventContextname -
public String getStringProperty(String name,
String defaultValue)
UMOEventContextevent.getMessage().getProperty(..., ...)
This will convert the returned value into a string
getStringProperty in interface UMOEventContextname - defaultValue -
public boolean isStreaming()
isStreaming in interface UMOEventContextpublic String getEncoding()
getEncoding in interface UMOEventContextpublic UMOSession getSession()
getSession in interface UMOEventContextpublic String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||