Java Code Examples for org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter#setDirectory()
The following examples show how to use
org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter#setDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NumberOfDestinationsTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected void configureBroker(BrokerService answer) throws Exception { File dataFileDir = new File("target/test-amq-data/perfTest/kahadb"); KahaDBPersistenceAdapter kaha = new KahaDBPersistenceAdapter(); kaha.setDirectory(dataFileDir); //answer.setUseJmx(false); // The setEnableJournalDiskSyncs(false) setting is a little dangerous right now, as I have not verified // what happens if the index is updated but a journal update is lost. // Index is going to be in consistent, but can it be repaired? //kaha.setEnableJournalDiskSyncs(false); // Using a bigger journal file size makes he take fewer spikes as it is not switching files as often. //kaha.setJournalMaxFileLength(1024*100); // small batch means more frequent and smaller writes //kaha.setIndexWriteBatchSize(100); // do the index write in a separate thread //kaha.setEnableIndexWriteAsync(true); answer.setPersistenceAdapter(kaha); answer.setAdvisorySupport(false); answer.setEnableStatistics(false); answer.addConnector(bindAddress); answer.setDeleteAllMessagesOnStartup(true); }
Example 2
Source File: QueuePurgeTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { setMaxTestTime(10 * 60 * 1000); // 10 mins setAutoFail(true); super.setUp(); broker = new BrokerService(); File testDataDir = new File("target/activemq-data/QueuePurgeTest"); broker.setDataDirectoryFile(testDataDir); broker.setUseJmx(true); broker.setDeleteAllMessagesOnStartup(true); broker.getSystemUsage().getMemoryUsage().setLimit(1024L * 1024 * 64); KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter(); persistenceAdapter.setDirectory(new File(testDataDir, "kahadb")); broker.setPersistenceAdapter(persistenceAdapter); broker.addConnector("tcp://localhost:0"); broker.start(); factory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri().toString()); connection = factory.createConnection(); connection.start(); }
Example 3
Source File: DurableSubscriptionActivationTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private void createBroker(boolean delete) throws Exception { broker = BrokerFactory.createBroker("broker:(vm://localhost)"); broker.setKeepDurableSubsActive(true); broker.setPersistent(true); broker.setDeleteAllMessagesOnStartup(delete); KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter(); kahadb.setDirectory(new File("activemq-data/" + getName() + "-kahadb")); kahadb.setJournalMaxFileLength(500 * 1024); broker.setPersistenceAdapter(kahadb); broker.setBrokerName(getName()); // only if we pre-create the destinations broker.setDestinations(new ActiveMQDestination[]{topic}); broker.start(); broker.waitUntilStarted(); connection = createConnection(); }
Example 4
Source File: DurableSubProcessTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
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(); }
Example 5
Source File: DurableSubscriptionUnsubscribeTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
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(); }
Example 6
Source File: ActivemqConfiguration.java From onetwo with Apache License 2.0 | 5 votes |
@Bean public PersistenceAdapter kahaDBPersistenceAdapter(){ KahaDBStoreProps kahaProps = activemqProperties.getKahadbStore(); // default messages store is under AMQ_HOME/data/KahaDB/ KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter(); if(StringUtils.isNotBlank(kahaProps.getDataDir())){ File dataDir = new File(kahaProps.getDataDir()); if(!dataDir.exists()){ dataDir.mkdirs(); } kahadb.setDirectory(dataDir); } return kahadb; }
Example 7
Source File: CheckDuplicateMessagesOnDuplexTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
private PersistenceAdapter persistenceAdapterFactory_KahaDB(String path) { KahaDBPersistenceAdapter kahaDBPersistenceAdapter = new KahaDBPersistenceAdapter(); kahaDBPersistenceAdapter.setDirectory(new File(path)); kahaDBPersistenceAdapter.setIgnoreMissingJournalfiles(true); kahaDBPersistenceAdapter.setCheckForCorruptJournalFiles(true); kahaDBPersistenceAdapter.setChecksumJournalFiles(true); return kahaDBPersistenceAdapter; }
Example 8
Source File: RunBroker.java From activemq-artemis with Apache License 2.0 | 5 votes |
public static void main(String arg[]) { try { KahaDBPersistenceAdapter kahaDB = new KahaDBPersistenceAdapter(); File dataFileDir = new File("target/test-amq-data/perfTest/kahadb"); IOHelper.deleteChildren(dataFileDir); kahaDB.setDirectory(dataFileDir); // The setEnableJournalDiskSyncs(false) setting is a little // dangerous right now, as I have not verified // what happens if the index is updated but a journal update is // lost. // Index is going to be in consistent, but can it be repaired? // kaha.setEnableJournalDiskSyncs(false); // Using a bigger journal file size makes he take fewer spikes as it // is not switching files as often. // kaha.setJournalMaxFileLength(1024*1024*100); // small batch means more frequent and smaller writes kahaDB.setIndexWriteBatchSize(1000); kahaDB.setIndexCacheSize(10000); // do the index write in a separate thread // kahaDB.setEnableIndexWriteAsync(true); BrokerService broker = new BrokerService(); broker.setUseJmx(false); // broker.setPersistenceAdapter(adaptor); broker.setPersistenceAdapter(kahaDB); // broker.setPersistent(false); broker.setDeleteAllMessagesOnStartup(true); broker.addConnector("tcp://0.0.0.0:61616"); broker.start(); System.err.println("Running"); Thread.sleep(Long.MAX_VALUE); } catch (Throwable e) { e.printStackTrace(); } }
Example 9
Source File: KahaDBQueueTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void configureBroker(BrokerService answer, String uri) throws Exception { File dataFileDir = new File("target/test-amq-data/perfTest/kahadb"); File archiveDir = new File(dataFileDir, "archive"); KahaDBPersistenceAdapter kaha = new KahaDBPersistenceAdapter(); kaha.setDirectory(dataFileDir); kaha.setDirectoryArchive(archiveDir); kaha.setArchiveDataLogs(false); // The setEnableJournalDiskSyncs(false) setting is a little dangerous right now, as I have not verified // what happens if the index is updated but a journal update is lost. // Index is going to be in consistent, but can it be repaired? kaha.setEnableJournalDiskSyncs(true); // Using a bigger journal file size makes he take fewer spikes as it is not switching files as often. //kaha.setJournalMaxFileLength(1024*1024*100); // small batch means more frequent and smaller writes //kaha.setIndexWriteBatchSize(100); // do the index write in a separate thread kaha.setEnableIndexWriteAsync(true); kaha.setIndexCacheSize(10000); answer.setPersistenceAdapter(kaha); answer.addConnector(uri); answer.setDeleteAllMessagesOnStartup(true); }
Example 10
Source File: DurableSubProcessMultiRestartTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
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); broker.setKeepDurableSubsActive(true); File kahadbData = new File("activemq-data/" + getName() + "-kahadb"); if (deleteAllMessages) delete(kahadbData); broker.setPersistent(true); KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter(); kahadb.setDirectory(kahadbData); kahadb.setJournalMaxFileLength(20 * 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(); }
Example 11
Source File: DurableSubSelectorDelayTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
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(); }
Example 12
Source File: DurableSubSelectorDelayWithRestartTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
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(10 * 1024); kahadb.setCleanupInterval(5000); 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); LOG.info(toString() + "Starting Broker..."); broker.start(); broker.waitUntilStarted(); LOG.info(toString() + " Broker started!!"); }
Example 13
Source File: DurableSubDelayedUnsubscribeTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
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(); }
Example 14
Source File: NetworkBrokerDetachTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected void configureBroker(BrokerService broker) throws Exception { KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter(); persistenceAdapter.setDirectory(new File("target/activemq-data/kahadb/" + broker.getBrokerName() + "NetworBrokerDetatchTest")); broker.setPersistenceAdapter(persistenceAdapter); }
Example 15
Source File: DurableSubProcessWithRestartTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
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(); }
Example 16
Source File: DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
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(); }