Currently it is possible to programmatically send or dispatch events from objects managed by Mule, but the api is a little clunky and could be more explicit.
I propose adding a new method to the UMOManager called getCurrentEvent() which will return the event associated with the current thread.
Adding two new methods to the UMOSession
UMOEvent sendEvent(Object data, String providerName);
void dispatchEvent(Object data, String providerName);
There are methods already on the UMOSession like these vut the method signatures requires a UMOProviderdescriptor meaning the user user must look up the provider first. With these changes in place the user could dispatch events programmatically by doing the following -
UMOEvent event = MuleManager.getInstance().getCurrentEvent();
UMOEvent returnEvent = event.getSession().sendEvent(request, "purchaseOrderProvider");
PurchaseOrder po = (PurchaseOrder)returnEvent.getTransformedMessage();