Package org.mule.transaction

Examples of org.mule.transaction.MuleTransactionConfig


        // don't wait for ages, has to be set before TX is begun
        tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS);

        // this is one component with a TX always begin
        TransactionConfig config = new MuleTransactionConfig();
        config.setFactory(new XaTransactionFactory());
        config.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);
        TransactionTemplate template = new TransactionTemplate(config, muleContext);

        // and the callee component which should begin new transaction, current must be suspended
        final TransactionConfig nestedConfig = new MuleTransactionConfig();
        nestedConfig.setFactory(new XaTransactionFactory());
        nestedConfig.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);

        // start the call chain
        template.execute(new TransactionCallback<Void>()
        {
            public Void doInTransaction() throws Exception
View Full Code Here


        // don't wait for ages, has to be set before TX is begun
        tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS);

        // this is one component with a TX always begin
        TransactionConfig config = new MuleTransactionConfig();
        config.setFactory(new XaTransactionFactory());
        config.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);
        TransactionTemplate<Void> template = new TransactionTemplate<Void>(config, muleContext);

        // and the callee component which should begin new transaction, current must be suspended
        final TransactionConfig nestedConfig = new MuleTransactionConfig();
        nestedConfig.setFactory(new XaTransactionFactory());
        nestedConfig.setAction(TransactionConfig.ACTION_NONE);

        // start the call chain
        template.execute(new TransactionCallback<Void>()
        {
            public Void doInTransaction() throws Exception
View Full Code Here

        // don't wait for ages, has to be set before TX is begun
        tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS);

        // this is one service with a TX always begin
        TransactionConfig config = new MuleTransactionConfig();
        config.setFactory(new XaTransactionFactory());
        config.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);
        TransactionTemplate template = new TransactionTemplate(config, muleContext);

        // and the callee service which should join the current XA transaction, not begin a nested one
        final TransactionConfig nestedConfig = new MuleTransactionConfig();
        nestedConfig.setFactory(new XaTransactionFactory());
        nestedConfig.setAction(TransactionConfig.ACTION_BEGIN_OR_JOIN);

        // start the call chain
        template.execute(new TransactionCallback<Void>()
        {
            public Void doInTransaction() throws Exception
View Full Code Here

        return (InboundEndpoint) getTestEndpoint(null, null, null, null, null, context, new EndpointSource()
        {
            public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException
            {
                builder.setExchangePattern(mep);
                TransactionConfig txConfig = new MuleTransactionConfig();
                txConfig.setAction(TransactionConfig.ACTION_BEGIN_OR_JOIN);
                txConfig.setFactory(new TestTransactionFactory());
                builder.setTransactionConfig(txConfig);
                return context.getEndpointFactory().getInboundEndpoint(builder);
            }
        }, null);
    }
View Full Code Here

        while (client.request("jms://replyTo.queue", 2000) != null)
        {
            // slurp
        }

        MuleTransactionConfig tc = new MuleTransactionConfig();
        tc.setFactory(new JmsTransactionFactory());
        tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);

        // This enpoint needs to be registered prior to use cause we need to set
        // the transaction config so that the endpoint will "know" it is transacted
        // and not close the session itself but leave it up to the transaction.
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(
View Full Code Here

        while (client.request("jms://replyTo.queue", 2000) != null)
        {
            // hmm..mesages
        }

        MuleTransactionConfig tc = new MuleTransactionConfig();
        tc.setFactory(new JmsTransactionFactory());
        tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);

        // This enpoint needs to be registered prior to use cause we need to set
        // the transaction config so that the endpoint will "know" it is transacted
        // and not close the session itself but leave it up to the transaction.
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(
View Full Code Here

        while (client.request("jms://replyTo.queue", 2000) != null)
        {
            // yum!
        }

        MuleTransactionConfig tc = new MuleTransactionConfig();
        tc.setFactory(new JmsTransactionFactory());
        tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);

        // This enpoint needs to be registered prior to use cause we need to set
        // the transaction config so that the endpoint will "know" it is transacted
        // and not close the session itself but leave it up to the transaction.
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(
View Full Code Here

    }

    protected void emptyReplyQueue() throws Exception
    {
        final MuleClient client = new MuleClient(muleContext);
        MuleTransactionConfig tc = new MuleTransactionConfig();
        tc.setFactory(new JmsTransactionFactory());
        tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);
        TransactionTemplate<Void> tt = new TransactionTemplate<Void>(tc, muleContext);
        tt.execute(new TransactionCallback<Void>()
        {
            public Void doInTransaction() throws Exception
            {
View Full Code Here

        return transactionConfig != null ? transactionConfig : getDefaultTransactionConfig();
    }

    protected TransactionConfig getDefaultTransactionConfig()
    {
        return new MuleTransactionConfig();
    }
View Full Code Here

    final Integer maxRes = parseMaxResults(maxResults);
    final Integer startPos = parseStartPosition(startPosition);

    if (startTransaction) {
      TransactionConfig config = new MuleTransactionConfig();
      config.setFactory(new XaTransactionFactory());
      config.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);
      ExecutionTemplate<Object> executionTemplate = TransactionalExecutionTemplate.createTransactionalExecutionTemplate(muleContext, config);
      try {
        return executionTemplate.execute(new ExecutionCallback<Object>() {
          public Object process() throws Exception {
            return callback.process(executeJpaQuery(query, Boolean.FALSE, null, maxRes, startPos));
View Full Code Here

TOP

Related Classes of org.mule.transaction.MuleTransactionConfig

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.