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 simple 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. (Or at least, not one that I, as someone
who's not very familiar with that code, see.)

I'd suggest you submit an enhancement request in JIRA to ask for a
BrokerView.addNetworkConnector(String discoveryAddress, String
networkConnectorName) method to be added, to allow the name to be specified
by the caller.

Tim

On Sun, May 13, 2018 at 6:50 AM, maorbl <mao...@gmail.com> wrote:

> Hi,
>
> When adding a network connector, 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);
>             // add the NC
>             proxyBroker.addNetworkConnector("static://"+urlBroker2);
>
> Sometime after I try to add another one:
>
> 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.
>
> 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)
>
> I understand that it fails on InstanceAlreadyExistsException, but I don't
> know
> how to overcome it.
>
> A workaround is to remove the fist network connector
> proxyBroker.removeNetworkConnector("NC");
>
> and then add both network connectors:
> proxyBroker.addNetworkConnector("static://"+urlBroker2+","+urlBroker3);
>
> Any help will be appreciated.
>
> Thanks,
> Maor
>
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>

Reply via email to