使用bitronox管理器,XA无法与我的自定义dev-kit适配器一起使用

问题描述 投票:0回答:1

我用dev-kit开发了自定义连接器,我的连接器充当了它的源,它连接到ejb并提取数据,然后发送到另一个端点。

我正在使用bitronix作为交易管理器。

我使用以下代码在m子交易环境中注册我的ejb。

public static void registerXaResource(MuleContext muleContext) {
    EJBClientTransactionContext txContext = EJBClientTransactionContext.create(muleContext.getTransactionManager(),
            getSynchronizationRegistry());
    EJBClientTransactionContext.setGlobalContext(txContext);
    XaResourceProducer.registerXAResource("dummyResource", new DummyXaResource());
}

/**
 * @return
 */
private static TransactionSynchronizationRegistry getSynchronizationRegistry() {
    return TransactionManagerServices.getTransactionSynchronizationRegistry();
}

之后,将下一个端点用作JMS并配置了XA,始终加入。但是它的行为不像XA。看起来bitronix取消了JMS资源的清单。

2019-12-11 16:59:48,398 [Receiving Thread] DEBUG 

bitronix.tm.resource.jms.DualSessionWrapper - choosing XA session
2019-12-11 16:59:48,410 [Receiving Thread] DEBUG bitronix.tm.resource.jms.DualSessionWrapper - looking for producer based on a MessageProducerConsumerKey on ActiveMQQueue[sampleReplyQueue]
2019-12-11 16:59:48,410 [Receiving Thread] DEBUG bitronix.tm.resource.jms.DualSessionWrapper - found no producer based on a MessageProducerConsumerKey on ActiveMQQueue[sampleReplyQueue], creating it
2019-12-11 16:59:48,411 [Receiving Thread] DEBUG bitronix.tm.resource.jms.DualSessionWrapper - choosing XA session
2019-12-11 16:59:48,447 [Receiving Thread] DEBUG bitronix.tm.resource.jms.DualSessionWrapper - closing a DualSessionWrapper in state ACCESSIBLE of a JmsPooledConnection of pool 1605822565-inboundtest-JMS in state ACCESSIBLE with underlying connection org.apache.activemq.artemis.jms.client.ActiveMQXAConnection@207dd1b7
2019-12-11 16:59:48,447 [Receiving Thread] DEBUG bitronix.tm.resource.common.TransactionContextHelper - delisting a DualSessionWrapper in state ACCESSIBLE of a JmsPooledConnection of pool 1605822565-inboundtest-JMS in state ACCESSIBLE with underlying connection org.apache.activemq.artemis.jms.client.ActiveMQXAConnection@207dd1b7 from a Bitronix Transaction with GTRID [31363035383232353635000000002582E13C00000001], status=ACTIVE, 1 resource(s) enlisted (started Thu Jan 08 12:18:54 IST 1970)
2019-12-11 16:59:48,447 [Receiving Thread] DEBUG bitronix.tm.resource.common.TransactionContextHelper - resource is not in enlisting global transaction context: a DualSessionWrapper in state ACCESSIBLE of a JmsPooledConnection of pool 1605822565-inboundtest-JMS in state ACCESSIBLE with underlying connection org.apache.activemq.artemis.jms.client.ActiveMQXAConnection@207dd1b7
2019-12-11 16:59:48,447 [Receiving Thread] DEBUG bitronix.tm.resource.common.TransactionContextHelper - requeuing a DualSessionWrapper in state ACCESSIBLE of a JmsPooledConnection of pool 1605822565-inboundtest-JMS in state ACCESSIBLE with underlying connection org.apache.activemq.artemis.jms.client.ActiveMQXAConnection@207dd1b7 from a Bitronix Transaction with GTRID [31363035383232353635000000002582E13C00000001], status=ACTIVE, 1 resource(s) enlisted (started Thu Jan 08 12:18:54 IST 1970)
2019-12-11 16:59:48,447 [Receiving Thread] DEBUG bitronix.tm.resource.common.TransactionContextHelper - resource is not in enlisting global transaction context: a DualSessionWrapper in state ACCESSIBLE of a JmsPooledConnection of pool 1605822565-inboundtest-JMS in state ACCESSIBLE with underlying connection org.apache.activemq.artemis.jms.client.ActiveMQXAConnection@207dd1b7

根据日志,JMS不在我开始的事务之下。

或者是实现XA Mule自定义连接器的正确方法。

mule mule-esb bitronix
1个回答
0
投票

Devkit不支持事务。可能仅以这种方式注册资源不足以完全实现XA事务。

Mule 4的SDK确实支持transactions,尽管我知道这不是您感兴趣的版本。

© www.soinside.com 2019 - 2024. All rights reserved.