activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Dillon <ja...@planet57.com>
Subject Re: Possible to add new transport connector post broker start?
Date Fri, 09 Dec 2011 03:09:35 GMT
I tried this and found out that calling addConnector() post-start won't do anything.  But I
can make a tiny sub-class that will:

    public class BrokerService2
        extends BrokerService
    {
        @Override
        public TransportConnector addConnector(final TransportConnector connector) throws
Exception {
            TransportConnector c = super.addConnector(connector);
            if (isStarted()) {
                c.setBrokerService(this);
                c = startTransportConnector(c);
            }
            return c;
        }
    }

It looks like the setBrokerService() + startTransportConnector() are the calls that BrokerService.start()
would end up calling anyways.

The above code also looks like it hooks up to the bits on shutdown, so BrokerService.stop()
will actually stop this connector added post-start.

Does this look correct?

Is there any risk to adding a connector post-start like this?

--jason


On Dec 8, 2011, at 3:50 PM, Jason Dillon wrote:

> Is it possible to add a new transport connector to a broker post starting the BrokerService?
> 
> I'd like to start up a broker w/o any transports for vm:// use only, but may need to
configure a transport (tcp or ssl) after the application is already up and using the broker,
so it would be a pita to stop the broker add the transport connector and then start it again.
> 
> Is this possible?  If so any thing to watch out for here?
> 
> --jason


Mime
View raw message