activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Wuwer <m.wu...@googlemail.com>
Subject Re: ActiveMQ and addConnector, addNetworkConnector
Date Mon, 22 Nov 2010 23:10:15 GMT
 Hi,
I found this posting when searching for issues with adding of multiple
NetworkConnectors.

The problem I have is that when I add the second connector I get the
following exception:
java.io.IOException: Network Connector could not be registered in JMX:
org.apache.activemq:BrokerName=localhost,Type=NetworkConnector,NetworkConnectorName=localhost
    at
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
    at
org.apache.activemq.broker.BrokerService.registerNetworkConnectorMBean(BrokerService.java:1699)

This can be reproduced with ActiveMQ 5.4.1 and the following test method
(can be added to e.g. org.apache.activemq.broker.BrokerServiceTest):

    public void testAddRemoveTwoNetworkConnectorsWithJMX() throws
Exception {
        BrokerService service = new BrokerService();
        service.setPersistent(false);
        service.setUseJmx(true);       
       
        NetworkConnector connector1 =
service.addNetworkConnector("static://(tcp://frontend1:61616)"); 
        NetworkConnector connector2 =
service.addNetworkConnector("static://(tcp://frontend2:61616)"); 
        service.start();

        service.removeNetworkConnector(connector1);
        connector1.stop();
        service.removeNetworkConnector(connector2);
        connector2.stop();
        service.stop();
    }

Looking at ActiveMQ code I think I found a  workaround.
When the name of the connector is set before adding it to broker it
works, e.g. like this:

        NetworkConnector connector1 = new DiscoveryNetworkConnector(new
URI("static://(tcp://frontend1:61616)"));
        connector1.setName("frontend1");
        service.addNetworkConnector(connector1); 
        NetworkConnector connector2 = new DiscoveryNetworkConnector(new
URI("static://(tcp://frontend2:61616)"));
        connector2.setName("frontend2");
        service.addNetworkConnector(connector2); 

Anyway, in my opinion it is still an issue, because as far as it is
possible to add a NetworkConnector without setting
a name, the implementation should cope with name == null and e.g.
generate a unique name.

I could not find any related issue, so I guess Ryan did not wrote it as
suggested.

Best regards,
Mark

On 03/18/2010 03:21 PM, Gary Tully wrote:
>
> can you raise an issue for this, with the url you pass to
> addNetworkConnector. I see some of the networkConnectors override the
> getName method to make it unique but not all do.
>
> On 16 March 2010 15:41, Ryan Moquin <fragility2.0@gmail.com> wrote:
>
> > I was experimenting with adding network connectors to ActiveMQ
> through JMX.
> > There is either a problem with the addConnector and addNetworkConnector
> > methods or there is something I'm missing.  If you connect via JMX to
> > ActiveMQ and call the addNetworkConnector JMX method, it works, the
> first
> > time.  The return value from the method is "localhost".  The problem is
> > that
> > when you try to add a second one, the names conflict because that one is
> > also called "localhost" and an exception is thrown.  It doesn't
> appear that
> > there is any addNetworkConnector or addConnector methods that also
> take a
> > name for the connector, are there?  Is there any other way to do this?
> >
> > I'm using Fuse ESB 4.2 and can no longer access the broker directly
> like I
> > could in Fuse ESB 3.x.
> >
> > Ryan
> >
>
>
>
> --
> http://blog.garytully.com
>
> Open Source Integration
> http://fusesource.com
>



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message