mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2927 - support for configuring custom broker id
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@999924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9041c3fc78
commit
996b7a53a3
|
@ -522,7 +522,9 @@ public class BrokerService implements Service {
|
||||||
registerFTConnectorMBean(masterConnector);
|
registerFTConnectorMBean(masterConnector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
brokerId = broker.getBrokerId();
|
if (brokerId == null) {
|
||||||
|
brokerId = broker.getBrokerId();
|
||||||
|
}
|
||||||
if (ioExceptionHandler == null) {
|
if (ioExceptionHandler == null) {
|
||||||
setIoExceptionHandler(new DefaultIOExceptionHandler());
|
setIoExceptionHandler(new DefaultIOExceptionHandler());
|
||||||
}
|
}
|
||||||
|
@ -1820,6 +1822,9 @@ public class BrokerService implements Service {
|
||||||
regionBroker.setKeepDurableSubsActive(keepDurableSubsActive);
|
regionBroker.setKeepDurableSubsActive(keepDurableSubsActive);
|
||||||
regionBroker.setBrokerName(getBrokerName());
|
regionBroker.setBrokerName(getBrokerName());
|
||||||
regionBroker.getDestinationStatistics().setEnabled(enableStatistics);
|
regionBroker.getDestinationStatistics().setEnabled(enableStatistics);
|
||||||
|
if (brokerId != null) {
|
||||||
|
regionBroker.setBrokerId(brokerId);
|
||||||
|
}
|
||||||
return regionBroker;
|
return regionBroker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,6 +2350,9 @@ public class BrokerService implements Service {
|
||||||
|
|
||||||
public void setBrokerContext(BrokerContext brokerContext) {
|
public void setBrokerContext(BrokerContext brokerContext) {
|
||||||
this.brokerContext = brokerContext;
|
this.brokerContext = brokerContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBrokerId(String brokerId) {
|
||||||
|
this.brokerId = new BrokerId(brokerId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,10 @@ public class AMQ2927Test extends JmsMultipleBrokersTestSupport {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setAutoFail(true);
|
super.setAutoFail(true);
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
|
BrokerService brokerA = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
|
||||||
createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=true&useJmx=false"));
|
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);
|
NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker, false, 2, true, true);
|
||||||
aTOb.addStaticallyIncludedDestination(queue);
|
aTOb.addStaticallyIncludedDestination(queue);
|
||||||
NetworkConnector bTOa = bridgeBrokers(brokers.get("BrokerB").broker, brokers.get("BrokerA").broker, false, 2, true, true);
|
NetworkConnector bTOa = bridgeBrokers(brokers.get("BrokerB").broker, brokers.get("BrokerA").broker, false, 2, true, true);
|
||||||
|
@ -122,6 +124,7 @@ public class AMQ2927Test extends JmsMultipleBrokersTestSupport {
|
||||||
protected void restartBroker(String brokerName) throws Exception {
|
protected void restartBroker(String brokerName) throws Exception {
|
||||||
destroyBroker("BrokerA");
|
destroyBroker("BrokerA");
|
||||||
BrokerService broker = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false"));
|
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);
|
NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker, false, 2, true, true);
|
||||||
aTOb.addStaticallyIncludedDestination(queue);
|
aTOb.addStaticallyIncludedDestination(queue);
|
||||||
broker.start();
|
broker.start();
|
||||||
|
|
Loading…
Reference in New Issue