Search in sources :

Example 6 with KahaDBPersistenceAdapter

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

the class kahaDbJdbcLeaseQueueMasterSlaveTest 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);
    KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) master.getPersistenceAdapter();
    LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
    leaseDatabaseLocker.setCreateTablesOnStartup(true);
    leaseDatabaseLocker.setDataSource(getExistingDataSource());
    leaseDatabaseLocker.setStatements(new Statements());
    kahaDBPersistenceAdapter.setLocker(leaseDatabaseLocker);
    configureLocker(kahaDBPersistenceAdapter);
    configureBroker(master);
    master.start();
}
Also used : Statements(org.apache.activemq.store.jdbc.Statements) BrokerService(org.apache.activemq.broker.BrokerService) LeaseDatabaseLocker(org.apache.activemq.store.jdbc.LeaseDatabaseLocker) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 7 with KahaDBPersistenceAdapter

use of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter 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 8 with KahaDBPersistenceAdapter

use of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter 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 9 with KahaDBPersistenceAdapter

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

the class RecoverExpiredMessagesTest method initCombosForTestRecovery.

public void initCombosForTestRecovery() throws Exception {
    addCombinationValues("queuePendingPolicy", new PendingQueueMessageStoragePolicy[] { new FilePendingQueueMessageStoragePolicy(), new VMPendingQueueMessageStoragePolicy() });
    PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[] { new KahaDBPersistenceAdapter(), new JDBCPersistenceAdapter(DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory()), new OpenWireFormat()) };
    for (PersistenceAdapter adapter : persistenceAdapters) {
        adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory()));
    }
    addCombinationValues("persistenceAdapter", persistenceAdapters);
}
Also used : OpenWireFormat(org.apache.activemq.openwire.OpenWireFormat) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy) File(java.io.File) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 10 with KahaDBPersistenceAdapter

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

the class DurableSubscriptionUnsubscribeTest method startBroker.

private void startBroker(boolean deleteMessages) throws Exception {
    broker = BrokerFactory.createBroker("broker:(vm://" + getName() + ")");
    broker.setUseJmx(true);
    broker.getManagementContext().setCreateConnector(false);
    broker.setBrokerName(getName());
    broker.setPersistent(true);
    KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter();
    persistenceAdapter.setDirectory(new File("activemq-data/" + getName()));
    broker.setPersistenceAdapter(persistenceAdapter);
    if (deleteMessages) {
        broker.setDeleteAllMessagesOnStartup(true);
    }
    broker.setKeepDurableSubsActive(true);
    broker.start();
    broker.waitUntilStarted();
    connection = createConnection();
}
Also used : File(java.io.File) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Aggregations

KahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)40 File (java.io.File)18 BrokerService (org.apache.activemq.broker.BrokerService)12 Test (org.junit.Test)8 PersistenceAdapter (org.apache.activemq.store.PersistenceAdapter)5 Connection (javax.jms.Connection)4 Message (javax.jms.Message)4 MessageProducer (javax.jms.MessageProducer)4 Session (javax.jms.Session)4 Wait (org.apache.activemq.util.Wait)4 IOException (java.io.IOException)3 URI (java.net.URI)3 LinkedList (java.util.LinkedList)3 JMSException (javax.jms.JMSException)3 MessageConsumer (javax.jms.MessageConsumer)3 JDBCPersistenceAdapter (org.apache.activemq.store.jdbc.JDBCPersistenceAdapter)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 MessageListener (javax.jms.MessageListener)2 ObjectName (javax.management.ObjectName)2