Search in sources :

Example 6 with LevelDBStore

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

the class LevelDBDurableTopicTest method configureBroker.

/*
     * protected BrokerService createBroker() throws Exception{ Resource
     * resource=new ClassPathResource(
     * "org/apache/activemq/perf/kahaBroker.xml"); BrokerFactoryBean factory=new
     * BrokerFactoryBean(resource); factory.afterPropertiesSet(); BrokerService
     * result=factory.getBroker(); result.start(); return result; }
     */
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
    LevelDBStore store = new LevelDBStore();
    answer.setPersistenceAdapter(store);
    answer.setDeleteAllMessagesOnStartup(true);
    answer.addConnector(uri);
}
Also used : LevelDBStore(org.apache.activemq.leveldb.LevelDBStore)

Example 7 with LevelDBStore

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

the class LevelDBStoreQueueTest method configureBroker.

@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
    File dataFileDir = new File("target/test-amq-data/perfTest/amq");
    LevelDBStore adaptor = new LevelDBStore();
    adaptor.setDirectory(dataFileDir);
    answer.setPersistenceAdapter(adaptor);
    answer.addConnector(uri);
    answer.setDeleteAllMessagesOnStartup(true);
}
Also used : File(java.io.File) LevelDBStore(org.apache.activemq.leveldb.LevelDBStore)

Example 8 with LevelDBStore

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

the class SingleBrokerVirtualDestinationsWithWildcardLevelDBTest method configurePersistenceAdapter.

@Override
protected void configurePersistenceAdapter(BrokerService broker) throws IOException {
    File dataFileDir = new File("target/test-amq-data/leveldb/" + broker.getBrokerName());
    LevelDBStore kaha = new LevelDBStore();
    kaha.setDirectory(dataFileDir);
    broker.setPersistenceAdapter(kaha);
}
Also used : File(java.io.File) LevelDBStore(org.apache.activemq.leveldb.LevelDBStore)

Example 9 with LevelDBStore

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

the class DurableSubProcessConcurrentCommitActivateNoDuplicateTest 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 amqData = new File("activemq-data/" + getName() + "-leveldb");
            if (deleteAllMessages)
                delete(amqData);
            broker.setPersistent(true);
            LevelDBStore amq = new LevelDBStore();
            amq.setDirectory(amqData);
            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(1024 * 1024 * 1024);
    PolicyMap policyMap = new PolicyMap();
    PolicyEntry defaultEntry = new PolicyEntry();
    defaultEntry.setMaxAuditDepth(20000);
    policyMap.setDefaultEntry(defaultEntry);
    broker.setDestinationPolicy(policyMap);
    broker.start();
}
Also used : PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) File(java.io.File) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) LevelDBStore(org.apache.activemq.leveldb.LevelDBStore) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 10 with LevelDBStore

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

the class ManagedDurableSubscriptionTest method startBroker.

private void startBroker() throws Exception {
    broker = BrokerFactory.createBroker("broker:(vm://localhost)");
    broker.setKeepDurableSubsActive(false);
    broker.setPersistent(true);
    LevelDBStore persistenceAdapter = new LevelDBStore();
    persistenceAdapter.setDirectory(new File("activemq-data/" + getName()));
    broker.setPersistenceAdapter(persistenceAdapter);
    broker.setUseJmx(true);
    broker.getManagementContext().setCreateConnector(false);
    broker.setBrokerName(getName());
    broker.start();
    connection = createConnection();
}
Also used : 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