Search in sources :

Example 11 with LevelDBStore

use of org.apache.activemq.leveldb.LevelDBStore in project activemq-artemis by apache.

the class DurableSubProcessWithRestartTest 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);
    switch(PERSISTENT_ADAPTER) {
        case MEMORY:
            broker.setPersistent(false);
            break;
        case LEVELDB:
            File datadir = new File("activemq-data/" + getName() + "-leveldb");
            if (deleteAllMessages)
                delete(datadir);
            broker.setPersistent(true);
            LevelDBStore amq = new LevelDBStore();
            amq.setDirectory(datadir);
            broker.setPersistenceAdapter(amq);
            break;
        case KAHADB:
            File kahadbData = new File("activemq-data/" + getName() + "-kahadb");
            if (deleteAllMessages)
                delete(kahadbData);
            broker.setPersistent(true);
            KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
            kahadb.setDirectory(kahadbData);
            kahadb.setJournalMaxFileLength(5 * 1024 * 1024);
            broker.setPersistenceAdapter(kahadb);
            break;
    }
    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) LevelDBStore(org.apache.activemq.leveldb.LevelDBStore) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 12 with LevelDBStore

use of org.apache.activemq.leveldb.LevelDBStore in project activemq-artemis by apache.

the class QueueBrowsingLevelDBTest method createBroker.

@Override
public BrokerService createBroker() throws IOException {
    BrokerService broker = super.createBroker();
    LevelDBStore store = new LevelDBStore();
    store.setDirectory(new File("target/test-data/leveldb"));
    broker.setPersistenceAdapter(store);
    return broker;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) File(java.io.File) LevelDBStore(org.apache.activemq.leveldb.LevelDBStore)

Aggregations

LevelDBStore (org.apache.activemq.leveldb.LevelDBStore)12 File (java.io.File)10 BrokerService (org.apache.activemq.broker.BrokerService)2 KahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)2 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)1 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)1