Search in sources :

Example 1 with RecoveryManager

use of org.apache.activemq.artemis.ra.recovery.RecoveryManager in project activemq-artemis by apache.

the class HornetQProtocolManagerTest method testLegacy.

@Test
public void testLegacy() throws Exception {
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616?protocolManagerFactoryStr=" + HornetQClientProtocolManagerFactory.class.getName());
    connectionFactory.createConnection().close();
    ActiveMQConnectionFactory connectionFactory2 = new ActiveMQConnectionFactory("tcp://localhost:61617");
    connectionFactory2.createConnection().close();
    RecoveryManager manager = new RecoveryManager();
    manager.register(connectionFactory, null, null, new ConcurrentHashMap<String, String>());
    manager.register(connectionFactory2, null, null, new ConcurrentHashMap<String, String>());
    for (XARecoveryConfig resource : manager.getResources()) {
        try (ServerLocator locator = resource.createServerLocator();
            ClientSessionFactory factory = locator.createSessionFactory();
            ClientSession session = factory.createSession()) {
        // Nothing
        }
    }
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory) RecoveryManager(org.apache.activemq.artemis.ra.recovery.RecoveryManager) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) XARecoveryConfig(org.apache.activemq.artemis.service.extensions.xa.recovery.XARecoveryConfig) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Aggregations

ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)1 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)1 ActiveMQConnectionFactory (org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory)1 RecoveryManager (org.apache.activemq.artemis.ra.recovery.RecoveryManager)1 XARecoveryConfig (org.apache.activemq.artemis.service.extensions.xa.recovery.XARecoveryConfig)1 Test (org.junit.Test)1