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


Java BrokerService.setUseShutdownHook方法代碼示例

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


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

示例1: setUp

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

示例2: createBroker

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

示例3: initialize

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
public void initialize() {
    super.initialize();
    try {
        if (_config == null) {
            _broker = new BrokerService();
            _broker.setStartAsync(true);
            _broker.setBrokerName("default");
            _broker.setUseJmx(false);
            _broker.setPersistent(false);
            _broker.setDataDirectoryFile(new File(System.getProperty("java.io.tmpdir"), "activemq-data"));
            _broker.addConnector(ActiveMQConnectionFactory.DEFAULT_BROKER_BIND_URL);
            _broker.setUseShutdownHook(false);
        } else {
            _broker = BrokerFactory.createBroker(_config);
        }

        _broker.start();
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:23,代碼來源:ActiveMQMixIn.java

示例4: TestActiveMqBrokerPlugin

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
public TestActiveMqBrokerPlugin() throws Exception {

        broker = new BrokerService();
        // configure the broker
        broker.addConnector("tcp://localhost:0");
        broker.setDataDirectoryFile(new File(basedir, "target/activeMqData"));
        broker.setUseShutdownHook(false);
        broker.start();
        int port = broker.getTransportConnectors().get(0).getServer().getSocketAddress().getPort();

        setProperty("activeMqPort", Integer.toString(port));
        write(new File(basedir, "target/test-classes/activeMqPort.txt").toPath(), Integer.toString(port).getBytes());

    }
 
開發者ID:kantega,項目名稱:respiro,代碼行數:15,代碼來源:TestActiveMqBrokerPlugin.java

示例5: configureBroker

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

示例6: configureBroker

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

示例7: configureConsumerBroker

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

示例8: configureProducerBroker

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

示例9: createBroker

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

示例10: setUp

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

示例11: createDeployment

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Deployment(testable = false)
public static JavaArchive createDeployment() throws Exception {
    _broker = new BrokerService();
    _broker.setBrokerName("default");
    _broker.setUseJmx(false);
    _broker.setPersistent(false);
    _broker.addConnector("mqtt://localhost:1883");
    _broker.setUseShutdownHook(false);
    _broker.start();

    return ArquillianUtil.createJarQSDeployment("switchyard-camel-mqtt-binding");
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:13,代碼來源:CamelMQTTBindingQuickstartTest.java

示例12: before

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
public void before() throws Throwable {
    log.info("+++ BEFORE on JUnit Rule '" + id(Rule_Mats.class) + "', JMS and MATS:");
    String sysprop_matsTestActiveMq = System.getProperty(SYSPROP_MATS_TEST_ACTIVEMQ);

    // ::: Server (BrokerService)
    // ====================================

    // :? Do we have specific brokerUrl to connect to?
    if (sysprop_matsTestActiveMq == null) {
        // -> No - the system property was not set, hence start the in-vm broker.
        log.info("Setting up in-vm ActiveMQ BrokerService '" + BROKER_NAME + "' (i.e. the MQ server).");
        _amqServer = new BrokerService();
        _amqServer.setBrokerName(BROKER_NAME);
        _amqServer.setUseJmx(false); // No need for JMX registry.
        _amqServer.setPersistent(false); // No need for persistence (prevents KahaDB dirs from being created).
        _amqServer.setAdvisorySupport(false); // No need Advisory Messages.
        _amqServer.setUseShutdownHook(false);

        // :: Set Individual DLQ
        // Hear, hear: http://activemq.2283324.n4.nabble.com/PolicyMap-api-is-really-bad-td4284307.html
        PolicyMap destinationPolicy = new PolicyMap();
        _amqServer.setDestinationPolicy(destinationPolicy);
        PolicyEntry policyEntry = new PolicyEntry();
        policyEntry.setQueue(">");
        destinationPolicy.put(policyEntry.getDestination(), policyEntry);

        IndividualDeadLetterStrategy individualDeadLetterStrategy = new IndividualDeadLetterStrategy();
        individualDeadLetterStrategy.setQueuePrefix("DLQ.");
        policyEntry.setDeadLetterStrategy(individualDeadLetterStrategy);

        _amqServer.start();
    }
    else {
        // -> Yes, there is specified a brokerUrl to connect to, so we
        log.info("SKIPPING setup of in-vm ActiveMQ BrokerService (MQ server), since System Property '"
                + SYSPROP_MATS_TEST_ACTIVEMQ + "' was set (to [" + sysprop_matsTestActiveMq + "]).");
    }

    // ::: Client (ConnectionFactory)
    // ====================================

    // :: Find which broker URL to use
    String brokerUrl;
    if (sysprop_matsTestActiveMq == null) {
        brokerUrl = "vm://" + BROKER_NAME + "?create=false";
    }
    else if (SYSPROP_VALUE_LOCALHOST.equals(sysprop_matsTestActiveMq)) {
        brokerUrl = "tcp://localhost:61616";
    }
    else {
        brokerUrl = sysprop_matsTestActiveMq;
    }
    // :: Connect to the broker
    log.info("Setting up ActiveMQ ConnectionFactory (MQ client), brokerUrl: [" + brokerUrl + "].");
    _amqClient = new ActiveMQConnectionFactory(brokerUrl);
    RedeliveryPolicy redeliveryPolicy = _amqClient.getRedeliveryPolicy();
    // :: Only try redelivery once, since the unit tests does not need any more to prove that they work.
    redeliveryPolicy.setInitialRedeliveryDelay(500);
    redeliveryPolicy.setUseExponentialBackOff(false);
    redeliveryPolicy.setMaximumRedeliveries(1);

    // ::: MatsFactory
    // ====================================

    log.info("Setting up JmsMatsFactory.");
    _matsStringSerializer = new MatsDefaultJsonSerializer();
    // Allow for override in specialization classes, in particular the one with DB.
    _matsFactory = createMatsFactory(_matsStringSerializer, _amqClient);
    // For all test scenarios, it makes no sense to have a concurrency more than 1, unless explicitly testing that.
    _matsFactory.getFactoryConfig().setConcurrency(1);
    log.info("--- BEFORE done! JUnit Rule '" + id(Rule_Mats.class) + "', JMS and MATS.");
}
 
開發者ID:stolsvik,項目名稱:mats,代碼行數:74,代碼來源:Rule_Mats.java

示例13: configureBroker

import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:6,代碼來源:SimpleTopicTest.java


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