本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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");
}
示例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.");
}
示例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);
}