{
// if (applicationEvent.getEndpoint() != null) {
// endpoint.setEndpointURI(applicationEvent.getEndpoint());
// }
DefaultMuleMessage message = new DefaultMuleMessage(applicationEvent.getSource(),
applicationEvent.getProperties(), muleContext);
// has dispatch been triggered using beanFactory.publish()
// without a current event
if (applicationEvent.getMuleEventContext() != null)
{
// tell mule not to try and route this event itself
applicationEvent.getMuleEventContext().setStopFurtherProcessing(true);
applicationEvent.getMuleEventContext().dispatchEvent(message, endpoint);
}
else
{
MuleSession session = new DefaultMuleSession(service, muleContext);
DefaultMuleEvent event = new DefaultMuleEvent(message, endpoint.getExchangePattern(),
session);
RequestContext.setEvent(event);
// transform if necessary
if (endpoint.getTransformers() != null)
{
message = new DefaultMuleMessage(applicationEvent.getSource(),
applicationEvent.getProperties(), muleContext);
message.applyTransformers(event, endpoint.getTransformers());
}
endpoint.process(new DefaultMuleEvent(message, endpoint.getExchangePattern(), session));
}
}
catch (Exception e1)