You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Eugeny N Dzhurinsky <bo...@redwerk.com> on 2008/08/21 11:33:52 UTC

Re: Embedded broker, adding connections after broker was configured with xbean:

On Wed, Aug 20, 2008 at 01:35:58PM +0100, Gary Tully wrote:
> I think the issue is that the broker configured via
> "xbean:activemq.xml" is started eagerly. That is, it is started before
> your connector is added. What should help is to add a start="false"
> attribute to the broker xbean.
> 
> not sure what is deemed the correct way, there are a bunch of ways to
> configure and start a broker. A way that works for you is the correct
> way!
> 
> hope this helps.

This seems not working, as I found in sources for BrokerFactory:

==============================================================================================
    /**
     * Creates a broker from a URI configuration
     * 
     * @param brokerURI the URI scheme to configure the broker
     * @throws Exception
     */
    public static BrokerService createBroker(URI brokerURI) throws Exception {
        return createBroker(brokerURI, false);
    }

    /**
     * Creates a broker from a URI configuration
     * 
     * @param brokerURI the URI scheme to configure the broker
     * @param startBroker whether or not the broker should have its
     *                {@link BrokerService#start()} method called after
     *                construction
     * @throws Exception
     */
    public static BrokerService createBroker(URI brokerURI, boolean startBroker) throws Exception {
        if (brokerURI.getScheme() == null) {
            throw new IllegalArgumentException("Invalid broker URI, no scheme specified: " + brokerURI);
        }
        BrokerFactoryHandler handler = createBrokerFactoryHandler(brokerURI.getScheme());
        BrokerService broker = handler.createBroker(brokerURI);
        if (startBroker) {
            broker.start();
        }
        return broker;
    }
==============================================================================================

the method createBroker doesn't start the broker.

Or I didn't understand what you meant with 

> What should help is to add a start="false" attribute to the broker xbean.

Could you please advice?

-- 
Eugene N Dzhurinsky

Re: Embedded broker, adding connections after broker was configured with xbean:

Posted by Eugeny N Dzhurinsky <bo...@redwerk.com>.
On Thu, Aug 21, 2008 at 12:33:52PM +0300, Eugeny N Dzhurinsky wrote:
> the method createBroker doesn't start the broker.
> 
> Or I didn't understand what you meant with 
> 
> > What should help is to add a start="false" attribute to the broker xbean.
> 
> Could you please advice?

sorry, I've tried to rewrite the <broker> tag like this

<broker brokerName="broker0" xmlns="http://activemq.org/config/1.0"
start="false">

and everything works fine!

So looks like the fact the broker is being started when created using XBean
definition and the fact the broker doesn't respect the connections being added
to it after the broker is started are needing to be noticed somewhere in faq
or something like this :)

Thank you for help!

-- 
Eugene N Dzhurinsky