Maor Blumenfeld created AMQ-6960:
------------------------------------

             Summary: Add method BrokerView.addNetworkConnector(String 
discoveryAddress, String  networkConnectorName)
                 Key: AMQ-6960
                 URL: https://issues.apache.org/jira/browse/AMQ-6960
             Project: ActiveMQ
          Issue Type: New Feature
          Components: Broker
            Reporter: Maor Blumenfeld


After a broker has started, when adding a network connector (broker2),
the first one goes OK:

{{// create network connector over JMX ObjectName brokerObjectName = new 
ObjectName("org.apache.activemq:type=Broker,brokerName=" + broker1Name); 
BrokerViewMBean proxyBroker = (BrokerViewMBean) 
broker.getManagementContext().newProxyInstance(brokerObjectName, 
BrokerViewMBean.class, true); // let's add the NC String networkConnectorName = 
proxyBroker.addNetworkConnector("static://"+urlBroker2); }}

Sometime after I try to add another network connector (broker3):

{{brokerObjectName = new 
ObjectName("org.apache.activemq:type=Broker,brokerName=" + broker1Name); 
proxyBroker = (BrokerViewMBean) 
broker.getManagementContext().newProxyInstance(brokerObjectName, 
BrokerViewMBean.class, true); // let's add the NC networkConnectorName = 
proxyBroker.addNetworkConnector("static://"+urlBroker3); }}

This time it fails with this exception:

Caused by: javax.management.InstanceAlreadyExistsException: 
org.apache.activemq:type=Broker,brokerName=ig2-1,connector=networkConnectors,networkConnectorName=NC
 at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)

 

This appears to be a consequence of the fact that 
org.apache.activemq.network.NetworkBridgeConfiguration.name is defaulted to 

"NC" and there's not a way to set it to another value when calling 
org.apache.activemq.broker.jmx.BrokerView.addNetworkConnector(String) nor 
to rename it after it's created.

To solve this problem, please add support for the following method:
BrokerView.addNetworkConnector(String discoveryAddress, String 
networkConnectorName) 

to allow the network connector name to be specified by the caller. 

Thanks,

Maor



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to