Search in sources :

Example 1 with MultiKahaDBPersistenceAdapter

use of org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter in project activemq-artemis by apache.

the class mKahaDbQueueMasterSlaveTest method createMaster.

@Override
protected void createMaster() throws Exception {
    master = new BrokerService();
    master.setBrokerName("master");
    master.addConnector(MASTER_URL);
    master.setUseJmx(false);
    master.setPersistent(true);
    master.setDeleteAllMessagesOnStartup(true);
    MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
    List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
    FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
    defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
    defaultEntry.setPerDestination(true);
    adapters.add(defaultEntry);
    mKahaDB.setFilteredPersistenceAdapters(adapters);
    master.setPersistenceAdapter(mKahaDB);
    master.start();
}
Also used : FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) BrokerService(org.apache.activemq.broker.BrokerService) LinkedList(java.util.LinkedList) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 2 with MultiKahaDBPersistenceAdapter

use of org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter in project activemq-artemis by apache.

the class mKahaDBXARecoveryBrokerTest method configureBroker.

@Override
protected void configureBroker(BrokerService broker) throws Exception {
    super.configureBroker(broker);
    MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
    List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
    FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
    defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
    adapters.add(defaultEntry);
    FilteredKahaDBPersistenceAdapter special = new FilteredKahaDBPersistenceAdapter();
    special.setDestination(new ActiveMQQueue("special"));
    special.setPersistenceAdapter(new KahaDBPersistenceAdapter());
    adapters.add(special);
    mKahaDB.setFilteredPersistenceAdapters(adapters);
    broker.setPersistenceAdapter(mKahaDB);
}
Also used : FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) LinkedList(java.util.LinkedList) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 3 with MultiKahaDBPersistenceAdapter

use of org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter in project activemq-artemis by apache.

the class mLevelDBXARecoveryBrokerTest method configureBroker.

@Override
protected void configureBroker(BrokerService broker) throws Exception {
    super.configureBroker(broker);
    MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
    List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
    FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
    defaultEntry.setPersistenceAdapter(new LevelDBPersistenceAdapter());
    adapters.add(defaultEntry);
    FilteredKahaDBPersistenceAdapter special = new FilteredKahaDBPersistenceAdapter();
    special.setDestination(new ActiveMQQueue("special"));
    special.setPersistenceAdapter(new LevelDBPersistenceAdapter());
    adapters.add(special);
    mKahaDB.setFilteredPersistenceAdapters(adapters);
    broker.setPersistenceAdapter(mKahaDB);
}
Also used : FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) LevelDBPersistenceAdapter(org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) LinkedList(java.util.LinkedList)

Example 4 with MultiKahaDBPersistenceAdapter

use of org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter in project activemq-artemis by apache.

the class mKahaDbQueueMasterSlaveTest method createSlave.

@Override
protected void createSlave() throws Exception {
    // use a separate thread as the slave will block waiting for
    // the exclusive db lock
    Thread t = new Thread() {

        @Override
        public void run() {
            try {
                BrokerService broker = new BrokerService();
                broker.setBrokerName("slave");
                TransportConnector connector = new TransportConnector();
                connector.setUri(new URI(SLAVE_URL));
                broker.addConnector(connector);
                // no need for broker.setMasterConnectorURI(masterConnectorURI)
                // as the db lock provides the slave/master initialisation
                broker.setUseJmx(false);
                broker.setPersistent(true);
                MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
                List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
                FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
                defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
                defaultEntry.setPerDestination(true);
                adapters.add(defaultEntry);
                mKahaDB.setFilteredPersistenceAdapters(adapters);
                broker.setPersistenceAdapter(mKahaDB);
                broker.start();
                slave.set(broker);
                slaveStarted.countDown();
            } catch (IllegalStateException expectedOnShutdown) {
            } catch (Exception e) {
                fail("failed to start slave broker, reason:" + e);
            }
        }
    };
    t.start();
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) BrokerService(org.apache.activemq.broker.BrokerService) URI(java.net.URI) LinkedList(java.util.LinkedList) MultiKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter) FilteredKahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Aggregations

LinkedList (java.util.LinkedList)4 FilteredKahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter)4 MultiKahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter)4 KahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)3 BrokerService (org.apache.activemq.broker.BrokerService)2 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)2 URI (java.net.URI)1 TransportConnector (org.apache.activemq.broker.TransportConnector)1 LevelDBPersistenceAdapter (org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter)1