Examples of ExceptionStrategyNotification


Examples of org.mule.context.notification.ExceptionStrategyNotification

    public MuleEvent handleException(Exception ex, MuleEvent event)
    {
        try
        {
            muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_START));

            //keep legacy notifications
            fireNotification(ex);

            // Work with the root exception, not anything that wraps it
            //Throwable t = ExceptionHelper.getRootException(ex);

            logException(ex);
            doHandleException(ex, event);

            ExceptionPayload exceptionPayload = new DefaultExceptionPayload(ex);
            if (RequestContext.getEvent() != null)
            {
                RequestContext.setExceptionPayload(exceptionPayload);
            }
            event.getMessage().setPayload(NullPayload.getInstance());
            event.getMessage().setExceptionPayload(exceptionPayload);
            return event;
        }
        finally
        {
            muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_END));
        }
    }
View Full Code Here

Examples of org.mule.context.notification.ExceptionStrategyNotification

    final public MuleEvent handleException(Exception exception, MuleEvent event)
    {
        try
        {
            muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_START));
            FlowConstruct flowConstruct = event.getFlowConstruct();
            fireNotification(exception);
            logException(exception);
            processStatistics(event);
            event.getMessage().setExceptionPayload(new DefaultExceptionPayload(exception));
            event = beforeRouting(exception, event);
            event = route(event, exception);
            processOutboundRouterStatistics(flowConstruct);
            event = afterRouting(exception, event);
            markExceptionAsHandledIfRequired(exception);
            if (event != null && !VoidMuleEvent.getInstance().equals(event))
            {
                processReplyTo(event, exception);
                closeStream(event.getMessage());
                nullifyExceptionPayloadIfRequired(event);
            }
            return event;
        }
        catch (Exception e)
        {
            MessagingException messagingException;
            if (e instanceof MessagingException)
            {
                messagingException = (MessagingException) e;
            }
            else
            {
                messagingException = new MessagingException(event, e);
            }
            try
            {
                logger.error("Exception during exception strategy execution");
                logException(e);
                TransactionCoordination.getInstance().rollbackCurrentTransaction();
            }
            catch (Exception ex)
            {
                //Do nothing
            }
            event.getMessage().setExceptionPayload(new DefaultExceptionPayload(messagingException));
            return event;
        }
        finally
        {
            muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_END));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.