/** * Routes the current exception to an error endpoint such as a Dead Letter Queue (jms) This method * is only invoked if there is a UMOMassage available to dispatch. The message dispatched from * this method will be an <code>ExceptionMessage</code> which contains the exception thrown the * UMOMessage and any context information. * * @param message the UMOMessage being processed when the exception occurred * @param failedEndpoint optional; the endpoint being dispatched or recieved on when the error * occurred. This is NOT the endpoint that the message will be disptched on and is only * supplied to this method for logging purposes * @param t the exception thrown. This will be sent with the ExceptionMessage * @see ExceptionMessage */ protected void routeException(UMOMessage message, UMOEndpoint failedEndpoint, Throwable t) { UMOEndpoint endpoint = getEndpoint(t); if (endpoint != null) { try { logger.error( "Message being processed is: " + (message == null ? "null" : message.toString())); UMOEventContext ctx = RequestContext.getEventContext(); ExceptionMessage msg = null; if (failedEndpoint != null) { msg = new ExceptionMessage(getErrorMessagePayload(message), endpoint, t, ctx); } else { msg = new ExceptionMessage(getErrorMessagePayload(message), t, ctx); } ctx.sendEvent(new MuleMessage(msg, null), endpoint); logger.debug("routed Exception message via " + endpoint); } catch (UMOException e) { logFatal(message, e); } } else { markTransactionForRollback(); } }
/** * 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 <code> * org.mule.umo.lifecycle.Callable</code> or calling <code>UMOManager.getEventContext</code> to * obtain the UMOEventContext for the current thread. The user can programmatically control how * events are dispached. * * @param stopFurtherProcessing the value to set. */ public void setStopFurtherProcessing(boolean stopFurtherProcessing) { RequestContext.getEvent().setStopFurtherProcessing(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 <code> * org.mule.umo.lifecycle.Callable</code> or calling <code>UMOManager.getEventContext</code> to * obtain the UMOEventContext for the current thread. The user can programmatically control how * events are dispached. * * @return Returns true is the user has set stopFurtherProcessing. * @see org.mule.umo.manager.UMOManager * @see org.mule.umo.UMOEventContext * @see org.mule.umo.lifecycle.Callable */ public boolean isStopFurtherProcessing() { return RequestContext.getEvent().isStopFurtherProcessing(); }