All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mule.process.TransactionalProcessingTemplate Maven / Gradle / Ivy

There is a newer version: 3.9.0
Show newest version
/*
 * $Id:AbstractExternalTransactionTestCase.java 8215 2007-09-05 16:56:51Z aperepel $
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

package org.mule.process;

import org.mule.api.MuleContext;
import org.mule.api.MuleEvent;
import org.mule.api.transaction.TransactionConfig;
import org.mule.transaction.MuleTransactionConfig;

public class TransactionalProcessingTemplate implements ProcessingTemplate
{
    private ProcessingInterceptor processingInterceptor;

    public TransactionalProcessingTemplate(MuleContext muleContext, TransactionConfig transactionConfig)
    {
        if (transactionConfig == null)
        {
            transactionConfig = new MuleTransactionConfig();
        }
        final boolean processTransactionOnException = false;
        ProcessingInterceptor tempProcessingInterceptor = new ExecuteCallbackInterceptor();
        tempProcessingInterceptor = new BeginAndResolveTransactionInterceptor(tempProcessingInterceptor,transactionConfig,muleContext, processTransactionOnException);
        tempProcessingInterceptor = new ResolvePreviousTransactionInterceptor(tempProcessingInterceptor,transactionConfig);
        tempProcessingInterceptor = new SuspendXaTransactionInterceptor(tempProcessingInterceptor,transactionConfig,processTransactionOnException);
        tempProcessingInterceptor = new ValidateTransactionalStateInterceptor(tempProcessingInterceptor,transactionConfig);
        this.processingInterceptor = new ExternalTransactionInterceptor(tempProcessingInterceptor,transactionConfig, muleContext);
    }

    @Override
    public T execute(ProcessingCallback processingCallback) throws Exception
    {
        return processingInterceptor.execute(processingCallback);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy