Java Code Examples for org.apache.activemq.broker.BrokerService#setUseShutdownHook()

The following examples show how to use org.apache.activemq.broker.BrokerService#setUseShutdownHook() . 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: QueueOptimizedDispatchExceptionTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {

   // Setup and start the broker
   broker = new BrokerService();
   broker.setBrokerName(brokerName);
   broker.setPersistent(false);
   broker.setSchedulerSupport(false);
   broker.setUseJmx(false);
   broker.setUseShutdownHook(false);
   broker.addConnector(brokerUrl);

   // Start the broker
   broker.start();
   broker.waitUntilStarted();
}
 
Example 2
Source File: StartAndStopBrokerTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
protected BrokerService createBroker() throws JMSException {
   BrokerService broker = null;

   try {
      broker = BrokerFactory.createBroker(new URI("broker://()/localhost"));
      broker.setBrokerName("DefaultBroker");
      broker.addConnector("tcp://localhost:9100");
      broker.setUseShutdownHook(false);

      broker.start();
   } catch (Exception e) {
      e.printStackTrace();
   }

   return broker;
}
 
Example 3
Source File: EmbeddedActiveMQ.java    From james-project with Apache License 2.0 6 votes vote down vote up
private void launchEmbeddedBroker(FileSystem fileSystem) throws Exception {
    brokerService = new BrokerService();
    brokerService.setBrokerName(BROKER_NAME);
    brokerService.setUseJmx(false);
    brokerService.setPersistent(true);
    brokerService.setDataDirectoryFile(fileSystem.getFile(BROCKERS_LOCATION));
    brokerService.setUseShutdownHook(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setBrokerId(BROKER_ID);
    String[] uris = {BROCKER_URI};
    brokerService.setTransportConnectorURIs(uris);
    ManagementContext managementContext = new ManagementContext();
    managementContext.setCreateConnector(false);
    brokerService.setManagementContext(managementContext);
    brokerService.setPersistenceAdapter(persistenceAdapter);
    BrokerPlugin[] brokerPlugins = {new StatisticsBrokerPlugin()};
    brokerService.setPlugins(brokerPlugins);
    String[] transportConnectorsURIs = {BROCKER_URI};
    brokerService.setTransportConnectorURIs(transportConnectorsURIs);
    brokerService.start();
    LOGGER.info("Started embedded activeMq");
}
 
Example 4
Source File: KahaDBDurableTopicTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   //AMQPersistenceAdapterFactory persistenceFactory = new AMQPersistenceAdapterFactory();
   //persistenceFactory.setMaxFileLength(1024*16);
   //persistenceFactory.setPersistentIndex(true);
   //persistenceFactory.setCleanupInterval(10000);
   //answer.setPersistenceFactory(persistenceFactory);
   answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
   answer.setEnableStatistics(false);
}
 
Example 5
Source File: SimpleDurableTopicTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   LevelDBStoreFactory persistenceFactory = new LevelDBStoreFactory();
   answer.setPersistenceFactory(persistenceFactory);
   //answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}
 
Example 6
Source File: SimpleNetworkTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected void configureConsumerBroker(BrokerService answer, String uri) throws Exception {
   configureBroker(answer);
   answer.setPersistent(false);
   answer.setBrokerName(CONSUMER_BROKER_NAME);
   answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}
 
Example 7
Source File: SimpleNetworkTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected void configureProducerBroker(BrokerService answer, String uri) throws Exception {
   configureBroker(answer);
   answer.setBrokerName(PRODUCER_BROKER_NAME);
   answer.setMonitorConnectionSplits(false);
   //answer.setSplitSystemUsageForProducersConsumers(true);
   answer.setPersistent(false);
   answer.setDeleteAllMessagesOnStartup(true);
   NetworkConnector connector = answer.addNetworkConnector("static://" + consumerBindAddress);
   //connector.setNetworkTTL(3);
   //connector.setDynamicOnly(true);
   connector.setDuplex(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}
 
Example 8
Source File: FailoverClusterTestSupport.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected BrokerService createBroker(String brokerName) throws Exception {
   BrokerService answer = new BrokerService();
   answer.setPersistent(false);
   answer.setUseJmx(false);
   answer.setBrokerName(brokerName);
   answer.setUseShutdownHook(false);
   return answer;
}
 
Example 9
Source File: TopicProducerFlowControlTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
   // Setup and start the broker
   broker = new BrokerService();
   broker.setBrokerName(brokerName);
   broker.setPersistent(false);
   broker.setSchedulerSupport(false);
   broker.setUseJmx(false);
   broker.setUseShutdownHook(false);
   broker.addConnector(brokerUrl);

   // Setup the destination policy
   PolicyMap pm = new PolicyMap();

   // Setup the topic destination policy
   PolicyEntry tpe = new PolicyEntry();
   tpe.setTopic(">");
   tpe.setMemoryLimit(destinationMemLimit);
   tpe.setProducerFlowControl(true);
   tpe.setAdvisoryWhenFull(true);

   // Setup the topic destination policy
   PolicyEntry qpe = new PolicyEntry();
   qpe.setQueue(">");
   qpe.setMemoryLimit(destinationMemLimit);
   qpe.setProducerFlowControl(true);
   qpe.setQueuePrefetch(1);
   qpe.setAdvisoryWhenFull(true);

   pm.setPolicyEntries(Arrays.asList(new PolicyEntry[]{tpe, qpe}));

   setDestinationPolicy(broker, pm);

   // Start the broker
   broker.start();
   broker.waitUntilStarted();
}
 
Example 10
Source File: SimpleTopicTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}
 
Example 11
Source File: LoadTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}