// 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(TransactionConfig.ACTION_ALWAYS_BEGIN);
config.setFactory(new XaTransactionFactory());
ExecutionTemplate<Void> executionTemplate = TransactionalExecutionTemplate.createTransactionalExecutionTemplate(muleContext, config);
// and the callee service which should join the current XA transaction, not begin a nested one
final TransactionConfig nestedConfig = new MuleTransactionConfig(TransactionConfig.ACTION_BEGIN_OR_JOIN);
nestedConfig.setFactory(new XaTransactionFactory());
// start the call chain
executionTemplate.execute(new ExecutionCallback<Void>()
{
public Void process() throws Exception