activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Posta <christian.po...@gmail.com>
Subject Re: BrokerContainer & SpringBrokerContainerFactory classes
Date Mon, 03 Mar 2014 13:55:49 GMT
Take a closer look at the API for Broker Factory Bean:
http://activemq.apache.org/maven/5.9.0/apidocs/org/apache/activemq/xbean/BrokerFactoryBean.html

You can pass in the resource/config file to the constructor, then call
"getBroker()" ..something like this:

    protected BrokerService createBroker(Resource resource) throws Exception {
        BrokerFactoryBean factory = new BrokerFactoryBean(resource);
        factory.afterPropertiesSet();

        BrokerService broker = factory.getBroker();

        assert broker != null : "Could not create broker!";

        // Broker is already started by default when using the XML file
        // broker.start();

        return broker;
    }


On Mon, Mar 3, 2014 at 6:33 AM, tvijayram <tvijayram@gmail.com> wrote:
> Hi Christian,
>
> Thanks for the help. In our application we are trying to create a Broker
> Container container by using the SpringBrokerContainerFactory's newInstance
> method.
> SpringBrokerContainerFactory's.newInstance(Resource).
>
> But in BrokerFactoryBean we don't have this method. And I tried to use
> setconfig(Resouce) which didn't help as I need to return the instance of
> BrokerService.
>
> /*Starts the Service Bus Broker*/
> start()
> {
>         brokerContainer = brokerCreate();
>         brokerContainer.start();
> }
>
>
> /*Create the broker, and return the instance.*/
> BrokerService brokerCreate()
> {
>         Resource resource = new FileSystemResource(configFile);
>         return SpringBrokerContainerFactory.newInstance(resource);
> }
>
> pls hep us.
>
>
> Thanks
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/BrokerContainer-SpringBrokerContainerFactory-classes-tp4678387p4678466.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Mime
View raw message