Java Code Examples for org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter#setJournalMaxFileLength()

The following examples show how to use org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter#setJournalMaxFileLength() . 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: DurableSubscriptionActivationTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
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 2
Source File: DurableSubProcessMultiRestartTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
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 3
Source File: DurableSubSelectorDelayTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
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 4
Source File: DurableSubSelectorDelayWithRestartTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
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 5
Source File: DurableSubDelayedUnsubscribeTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
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 6
Source File: DurableSubProcessWithRestartTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
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 7
Source File: DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
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();
}