Package org.mule.execution

Examples of org.mule.execution.TransactionalErrorHandlingExecutionTemplate


            }

            if (event != null)
            {
                final MuleEvent eventToProcess = event;
                TransactionalErrorHandlingExecutionTemplate executionTemplate = TransactionalErrorHandlingExecutionTemplate.createMainExecutionTemplate(muleContext, event.getFlowConstruct().getExceptionListener());
                ExecutionCallback<MuleEvent> processingCallback = new ExecutionCallback<MuleEvent>()
                {

                    @Override
                    public MuleEvent process() throws Exception
                    {
                        if (isStatsEnabled())
                        {
                            queueStatistics.decQueuedEvent();
                        }

                        if (logger.isDebugEnabled())
                        {
                            logger.debug(MessageFormat.format("{0}: Dequeued event from {1}",
                                getStageDescription(), getQueueName()));
                        }
                        AsyncMessageProcessorWorker work = new AsyncMessageProcessorWorker(eventToProcess);
                        try
                        {
                            // TODO Remove this thread handoff to ensure Zero Message Loss
                            workManagerSource.getWorkManager().scheduleWork(work, WorkManager.INDEFINITE,
                                null, new AsyncWorkListener(next));
                        }
                        catch (Exception e)
                        {
                            // because dequeued event may still be owned by a previuos
                            // thread we need to use the copy created in AsyncMessageProcessorWorker
                            // constructor.
                            OptimizedRequestContext.unsafeSetEvent(work.getEvent());
                            throw new MessagingException(work.getEvent(), e, SedaStageInterceptingMessageProcessor.this);
                        }
                        return null;
                    }
                };

                try
                {
                    executionTemplate.execute(processingCallback);
                }
                catch (MessagingException e)
                {
                    //Already handled by processing template
                }
View Full Code Here

TOP

Related Classes of org.mule.execution.TransactionalErrorHandlingExecutionTemplate

Copyright © 2018 www.massapicom. 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.