// Create an ExceptionMessage which contains the original payload, the exception, and some additional context info.
ExceptionMessage msg = new ExceptionMessage(event, t, component, endpointUri);
MuleMessage exceptionMessage = new DefaultMuleMessage(msg, event.getMessage(), muleContext);
// Create an outbound router with all endpoints configured on the exception strategy
MulticastingRouter router = new MulticastingRouter()
{
@Override
protected void setMessageProperties(FlowConstruct session, MuleMessage message, MessageProcessor target)
{
// No reply-to or correlation for exception targets, at least for now anyway.
}
};
router.setRoutes(getMessageProcessors());
router.setMuleContext(muleContext);
// Route the ExceptionMessage to the new router
router.process(new DefaultMuleEvent(exceptionMessage, event));
}
catch (Exception e)
{
logFatal(event, e);
}