Here are the examples of the java api class org.apache.activemq.artemis.tests.integration.ra.DummyTransactionManager taken from open source projects.
1. JMSBridgeReconnectionTest#performCrashAndReconnect()
Project: activemq-artemis
File: JMSBridgeReconnectionTest.java
File: JMSBridgeReconnectionTest.java
private void performCrashAndReconnect(boolean restart) throws Exception { cff1xa = new ConnectionFactoryFactory() { @Override public Object createConnectionFactory() throws Exception { ActiveMQXAConnectionFactory cf = (ActiveMQXAConnectionFactory) ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.XA_CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY, params1)); // Note! We disable automatic reconnection on the session factory. The bridge needs to do the reconnection cf.setReconnectAttempts(-1); cf.setBlockOnNonDurableSend(true); cf.setBlockOnDurableSend(true); cf.setCacheLargeMessagesClient(true); return cf; } }; DummyTransactionManager tm = new DummyTransactionManager(); DummyTransaction tx = new DummyTransaction(); tm.tx = tx; JMSBridgeImpl bridge = new JMSBridgeImpl(cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false).setBridgeName("test-bridge"); addActiveMQComponent(bridge); bridge.setTransactionManager(tm); bridge.start(); // Now crash the dest server JMSBridgeReconnectionTest.log.info("About to crash server"); jmsServer1.stop(); if (restart) { jmsServer1.start(); } // Wait a while before starting up to simulate the dest being down for a while JMSBridgeReconnectionTest.log.info("Waiting 5 secs before bringing server back up"); Thread.sleep(TIME_WAIT); JMSBridgeReconnectionTest.log.info("Done wait"); bridge.stop(); if (restart) { assertTrue(tx.rolledback); assertTrue(tx.targetConnected); } else { assertTrue(tx.rolledback); assertFalse(tx.targetConnected); } }