Search in sources :

Example 16 with KahaDBPersistenceAdapter

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

the class DurableConsumerCloseAndReconnectTest method createBroker.

protected void createBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setUseJmx(false);
    brokerService.setPersistent(false);
    KahaDBPersistenceAdapter store = new KahaDBPersistenceAdapter();
    brokerService.setPersistenceAdapter(store);
    brokerService.start();
    brokerService.waitUntilStarted();
    vmConnectorURI = brokerService.getVmConnectorURI().toString();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 17 with KahaDBPersistenceAdapter

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

the class DurableSubDelayedUnsubscribeTest method startBroker.

private void startBroker(boolean deleteAllMessages) throws Exception {
    if (broker != null)
        return;
    broker = BrokerFactory.createBroker("broker:(vm://" + getName() + ")");
    broker.setBrokerName(getName());
    broker.setAdvisorySupport(false);
    broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
    File kahadbData = new File("activemq-data/" + getName() + "-kahadb");
    if (deleteAllMessages)
        delete(kahadbData);
    broker.setPersistent(true);
    KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
    kahadb.setDirectory(kahadbData);
    kahadb.setJournalMaxFileLength(512 * 1024);
    broker.setPersistenceAdapter(kahadb);
    broker.addConnector("tcp://localhost:61656");
    broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
    broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);
    broker.getSystemUsage().getStoreUsage().setLimit(256 * 1024 * 1024);
    broker.start();
}
Also used : File(java.io.File) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 18 with KahaDBPersistenceAdapter

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

the class DurableSubProcessTest method startBroker.

private void startBroker(boolean deleteAllMessages) throws Exception {
    if (broker != null)
        return;
    broker = BrokerFactory.createBroker("broker:(vm://localhost)");
    broker.setBrokerName(getName());
    broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
    if (PERSISTENT_BROKER) {
        broker.setPersistent(true);
        KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter();
        persistenceAdapter.setDirectory(new File("activemq-data/" + getName()));
        broker.setPersistenceAdapter(persistenceAdapter);
    } else
        broker.setPersistent(false);
    broker.addConnector("tcp://localhost:61656");
    broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
    broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);
    broker.getSystemUsage().getStoreUsage().setLimit(256 * 1024 * 1024);
    broker.start();
}
Also used : File(java.io.File) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 19 with KahaDBPersistenceAdapter

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

the class DurableSubSelectorDelayTest method startBroker.

private void startBroker(boolean deleteAllMessages) throws Exception {
    if (broker != null)
        return;
    broker = BrokerFactory.createBroker("broker:(vm://" + getName() + ")");
    broker.setBrokerName(getName());
    broker.setAdvisorySupport(false);
    broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
    File kahadbData = new File("activemq-data/" + getName() + "-kahadb");
    if (deleteAllMessages)
        delete(kahadbData);
    broker.setPersistent(true);
    KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
    kahadb.setDirectory(kahadbData);
    kahadb.setJournalMaxFileLength(500 * 1024);
    broker.setPersistenceAdapter(kahadb);
    connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();
    broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
    broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);
    broker.getSystemUsage().getStoreUsage().setLimit(256 * 1024 * 1024);
    broker.start();
}
Also used : File(java.io.File) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 20 with KahaDBPersistenceAdapter

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

the class KahaDBSupportTest method create.

@Test
public void create() throws Exception {
    final String path = "target/kahatest" + System.currentTimeMillis();
    final BrokerService broker = BrokerFactory.createBroker(new URI("openejb:broker:(tcp://localhost:" + NetworkUtil.getNextAvailablePort() + ")?usekahadb=true&kahadb.directory=" + path));
    try {
        assertThat(broker.getPersistenceAdapter(), instanceOf(KahaDBPersistenceAdapter.class));
        final KahaDBPersistenceAdapter adapter = KahaDBPersistenceAdapter.class.cast(broker.getPersistenceAdapter());
        assertEquals(new File(path), adapter.getDirectory());
    } finally {
        broker.stop();
    }
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) URI(java.net.URI) File(java.io.File) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter) Test(org.junit.Test)

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