本文整理汇总了Java中org.apache.activemq.broker.BrokerService.setBrokerId方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.setBrokerId方法的具体用法?Java BrokerService.setBrokerId怎么用?Java BrokerService.setBrokerId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setBrokerId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EmbeddedActiveMQBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public EmbeddedActiveMQBroker(String brokerId) {
if ((brokerId == null) || (brokerId.isEmpty())) {
throw new IllegalArgumentException("brokerId is empty");
}
this.brokerId = brokerId;
tcpConnectorUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable();
brokerService = new BrokerService();
brokerService.setBrokerId(brokerId);
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
try {
brokerService.setPersistenceAdapter(new MemoryPersistenceAdapter());
brokerService.addConnector(tcpConnectorUri);
} catch (Exception e) {
throw new RuntimeException("Problem creating brokerService", e);
}
}
示例2: EmbeddedActiveMQBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public EmbeddedActiveMQBroker(String brokerId) {
Validate.notEmpty(brokerId, "brokerId is empty");
this.brokerId = brokerId;
tcpConnectorUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable();
brokerService = new BrokerService();
brokerService.setBrokerId(brokerId);
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
try {
brokerService.setPersistenceAdapter(new MemoryPersistenceAdapter());
brokerService.addConnector(tcpConnectorUri);
} catch (Exception e) {
throw new RuntimeException("Problem creating brokerService", e);
}
}
示例3: setUp
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setAutoFail(true);
super.setUp();
BrokerService brokerA = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
brokerA.setBrokerId("BrokerA");
BrokerService brokerB = createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
brokerB.setBrokerId("BrokerB");
NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker, false, 2, true, true);
aTOb.addStaticallyIncludedDestination(queue);
NetworkConnector bTOa = bridgeBrokers(brokers.get("BrokerB").broker, brokers.get("BrokerA").broker, false, 2, true, true);
bTOa.addStaticallyIncludedDestination(queue);
startAllBrokers();
waitForBridgeFormation();
}
示例4: EmbeddedTcpBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public EmbeddedTcpBroker(String name, int number) throws Exception {
brokerSvc = new BrokerService();
synchronized (this.getClass()) {
brokerNum = Next_broker_num;
Next_broker_num++;
}
brokerName = name + number;
brokerId = brokerName;
brokerSvc.setBrokerName(brokerName);
brokerSvc.setBrokerId(brokerId);
brokerSvc.setPersistent(false);
brokerSvc.setUseJmx(false);
port = 60000 + (brokerNum * 10);
tcpUrl = "tcp://127.0.0.1:" + Integer.toString(port);
fullUrl = tcpUrl + "?jms.watchTopicAdvisories=false";
brokerSvc.addConnector(tcpUrl);
}
示例5: startBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void startBroker() throws Exception {
String brokerName = "test-broker-" + System.currentTimeMillis();
String brokerUri = "vm://" + brokerName;
broker = new BrokerService();
broker.setBrokerName(brokerName);
broker.setBrokerId(brokerName);
broker.addConnector(brokerUri);
broker.setPersistent(false);
// This Broker Plugin simulates Producer Flow Control by delaying the broker's ACK by 2 seconds
broker.setPlugins(new BrokerPlugin[] {new DelayerBrokerPlugin()});
broker.start();
}
示例6: restartBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected void restartBroker(String brokerName) throws Exception {
destroyBroker("BrokerA");
BrokerService broker = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false"));
broker.setBrokerId("BrokerA");
NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker, false, 2, true, true);
aTOb.addStaticallyIncludedDestination(queue);
broker.start();
broker.waitUntilStarted();
waitForBridgeFormation();
}
示例7: configureBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
public void configureBroker(BrokerService brokerService) {
brokerService.setBrokerId(brokerService.getBrokerName());
}
示例8: configureBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void configureBroker(BrokerService broker) {
broker.setBrokerId(broker.getBrokerName());
}