當前位置: 首頁>>代碼示例>>Java>>正文


Java BrokerService.setDeleteAllMessagesOnStartup方法代碼示例

本文整理匯總了Java中org.apache.activemq.broker.BrokerService.setDeleteAllMessagesOnStartup方法的典型用法代碼示例。如果您正苦於以下問題:Java BrokerService.setDeleteAllMessagesOnStartup方法的具體用法?Java BrokerService.setDeleteAllMessagesOnStartup怎麽用?Java BrokerService.setDeleteAllMessagesOnStartup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.activemq.broker.BrokerService的用法示例。


在下文中一共展示了BrokerService.setDeleteAllMessagesOnStartup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Before
public void startBroker() throws Exception {
  LOG.info("Finding free network port");
  try (ServerSocket socket = new ServerSocket(0)) {
    port = socket.getLocalPort();
  }

  LOG.info("Starting ActiveMQ brokerService on {}", port);
  brokerService = new BrokerService();
  brokerService.setDeleteAllMessagesOnStartup(true);
  // use memory persistence for the test: it's faster and don't pollute test folder with KahaDB
  brokerService.setPersistent(false);
  brokerService.addConnector("mqtt://localhost:" + port);
  brokerService.start();
  brokerService.waitUntilStarted();
}
 
開發者ID:apache,項目名稱:beam,代碼行數:17,代碼來源:MqttIOTest.java

示例2: createBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
private void createBroker() throws Exception {
   broker = new BrokerService();
   broker.setPersistent(false);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.setUseJmx(true);
   connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();

   PolicyEntry policy = new PolicyEntry();
   policy.setAdvisoryForFastProducers(true);
   policy.setAdvisoryForConsumed(true);
   policy.setAdvisoryForDelivery(true);
   policy.setAdvisoryForDiscardingMessages(true);
   policy.setAdvisoryForSlowConsumers(true);
   policy.setAdvisoryWhenFull(true);
   policy.setProducerFlowControl(false);
   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);
   broker.setDestinationPolicy(pMap);

   broker.start();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:22,代碼來源:AdvisoryTopicCleanUpTest.java

示例3: setUp

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@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();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:22,代碼來源:QueuePurgeTest.java

示例4: createBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
private BrokerService createBroker() throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName("localhost");
   broker.setUseJmx(true);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.addConnector("vm://localhost");

   PolicyMap policyMap = new PolicyMap();
   PolicyEntry defaultEntry = new PolicyEntry();
   defaultEntry.setAdvisoryForSlowConsumers(true);

   policyMap.setDefaultEntry(defaultEntry);

   broker.setDestinationPolicy(policyMap);
   broker.start();
   broker.waitUntilStarted();
   return broker;
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:19,代碼來源:TopicSubscriptionSlowConsumerTest.java

示例5: createMaster

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected void createMaster() throws Exception {
   master = new BrokerService();
   master.setBrokerName("master");
   master.addConnector(MASTER_URL);
   master.setUseJmx(false);
   master.setPersistent(true);
   master.setDeleteAllMessagesOnStartup(true);
   KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) master.getPersistenceAdapter();
   LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
   leaseDatabaseLocker.setCreateTablesOnStartup(true);
   leaseDatabaseLocker.setDataSource(getExistingDataSource());
   leaseDatabaseLocker.setStatements(new Statements());
   kahaDBPersistenceAdapter.setLocker(leaseDatabaseLocker);
   configureLocker(kahaDBPersistenceAdapter);
   configureBroker(master);
   master.start();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:19,代碼來源:kahaDbJdbcLeaseQueueMasterSlaveTest.java

示例6: createMaster

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected void createMaster() throws Exception {
   master = new BrokerService();
   master.setBrokerName("master");
   master.addConnector(MASTER_URL);
   master.setUseJmx(false);
   master.setPersistent(true);
   master.setDeleteAllMessagesOnStartup(true);

   MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
   List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
   FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
   defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
   defaultEntry.setPerDestination(true);
   adapters.add(defaultEntry);

   mKahaDB.setFilteredPersistenceAdapters(adapters);
   master.setPersistenceAdapter(mKahaDB);

   master.start();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:22,代碼來源:mKahaDbQueueMasterSlaveTest.java

示例7: createBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected BrokerService createBroker() throws Exception {
    BrokerService brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);

    connectionURI = brokerService.addConnector("amqp://localhost:0").getPublishableConnectString();

    brokerService.start();
    brokerService.waitUntilStarted();

    return brokerService;
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:16,代碼來源:QpidJmsPoolTestSupport.java

示例8: setUp

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    brokerService.start();
    brokerService.waitUntilStarted();
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:15,代碼來源:PooledConnectionExpiredConnectionsUnderLoad.java

示例9: createBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected String createBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    brokerService.start();
    brokerService.waitUntilStarted();

    return brokerService.getVmConnectorURI().toString();
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:13,代碼來源:ActiveMQJmsPoolTestSupport.java

示例10: startBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
public void startBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setAdvisorySupport(false);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.getManagementContext().setCreateMBeanServer(false);
    brokerService.addConnector("tcp://0.0.0.0:0");

    ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();

    BrokerPlugin authenticationPlugin = configureAuthentication();
    if (authenticationPlugin != null) {
        plugins.add(configureAuthorization());
    }

    BrokerPlugin authorizationPlugin = configureAuthorization();
    if (authorizationPlugin != null) {
        plugins.add(configureAuthentication());
    }

    if (!plugins.isEmpty()) {
        BrokerPlugin[] array = new BrokerPlugin[plugins.size()];
        brokerService.setPlugins(plugins.toArray(array));
    }

    brokerService.start();
    brokerService.waitUntilStarted();

    connectionURI = brokerService.getTransportConnectors().get(0).getPublishableConnectString();
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:32,代碼來源:PooledConnectionSecurityExceptionTest.java

示例11: createBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
private BrokerService createBroker() throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName("localhost");
   broker.setUseJmx(false);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.addConnector("vm://localhost");
   broker.start();
   broker.waitUntilStarted();
   return broker;
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:11,代碼來源:TopicSubscriptionZeroPrefetchTest.java

示例12: setUp

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {
   setAutoFail(true);
   topic = false;
   verbose = true;
   // startup db
   sharedDs = (EmbeddedDataSource) DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory());

   broker = new BrokerService();

   DefaultIOExceptionHandler handler = new DefaultIOExceptionHandler();
   handler.setIgnoreSQLExceptions(false);
   handler.setStopStartConnectors(true);
   broker.setIoExceptionHandler(handler);
   broker.addConnector("tcp://localhost:0");
   broker.setUseJmx(false);
   broker.setPersistent(true);
   broker.setDeleteAllMessagesOnStartup(true);
   JDBCPersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter();
   persistenceAdapter.setDataSource(sharedDs);
   persistenceAdapter.setUseLock(false);
   persistenceAdapter.setLockKeepAlivePeriod(500);
   persistenceAdapter.getLocker().setLockAcquireSleepInterval(500);
   broker.setPersistenceAdapter(persistenceAdapter);
   broker.start();
   super.setUp();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:28,代碼來源:DbRestartJDBCQueueTest.java

示例13: createBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected BrokerService createBroker(String brokerName) throws Exception {
   BrokerService broker = new BrokerService();
   broker.setDeleteAllMessagesOnStartup(true);
   broker.setPersistent(true);
   broker.setUseJmx(false);
   broker.setBrokerName(brokerName);
   broker.addConnector(new URI(AUTO_ASSIGN_TRANSPORT));
   brokers.put(brokerName, new BrokerItem(broker));

   return broker;
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:13,代碼來源:BacklogNetworkCrossTalkTest.java

示例14: createMaster

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected void createMaster() throws Exception {
   master = new BrokerService();
   master.setBrokerName("master");
   master.addConnector(MASTER_URL);
   master.setUseJmx(false);
   master.setPersistent(true);
   master.setDeleteAllMessagesOnStartup(true);
   JDBCPersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter();
   persistenceAdapter.setDataSource(getExistingDataSource());
   configureJdbcPersistenceAdapter(persistenceAdapter);
   master.setPersistenceAdapter(persistenceAdapter);
   configureBroker(master);
   master.start();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:16,代碼來源:JDBCQueueMasterSlaveTest.java

示例15: createRestartedBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
private void createRestartedBroker() throws Exception {
   broker = new BrokerService();
   broker.setBrokerName("durable-broker");
   broker.setDeleteAllMessagesOnStartup(false);
   broker.setPersistenceAdapter(createPersistenceAdapter());
   broker.setPersistent(true);
   broker.start();
   broker.waitUntilStarted();

   connection = createConnection();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:12,代碼來源:DurableSubscriptionTestSupport.java


注:本文中的org.apache.activemq.broker.BrokerService.setDeleteAllMessagesOnStartup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。