String inboundProtocol = inboundEndpoint.getConnector().getProtocol();
String outboundProtocol = outboundEndpoint.getConnector().getProtocol();
boolean needXA = !inboundProtocol.equals(outboundProtocol);
TransactionConfig inboundTransactionConfig = inboundEndpoint.getTransactionConfig();
if (inboundTransactionConfig.getFactory() == null)
{
TransactionFactory transactionFactory = needXA
? new XaTransactionFactory()
: getTransactionFactory(inboundProtocol);
inboundTransactionConfig.setFactory(transactionFactory);
}
TransactionConfig outboundTransactionConfig = outboundEndpoint.getTransactionConfig();
if (outboundTransactionConfig.getFactory() == null)
{
TransactionFactory transactionFactory = needXA
? new XaTransactionFactory()
: getTransactionFactory(outboundProtocol);
outboundTransactionConfig.setFactory(transactionFactory);
}
}