本文整理匯總了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());
}