You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Kit Plummer <ki...@gmail.com> on 2010/11/05 19:58:37 UTC

Delay a Start-level?

I'm currently using Karaf Features (very cool feature) to deploy a suite of bundles.  My feature depends on activemq-blueprint - and subsequently there are services that require the broker to be running to get through their startup methods.

When I start Karaf (everytime) I get a nasty JMSException:

[karaf@root> javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused]

and I'm guessing this is because the broker hasn't finished starting yet.  The broker kicks off at start-level 60, and my bundles at 80 and 85.  Is there a "good" way to handle this?

TIA,
Kit

Re: Delay a Start-level?

Posted by Guillaume Nodet <gn...@gmail.com>.
I totally second that!

On Monday, November 8, 2010, Mike Van <mv...@comcast.net> wrote:
>
>
>
> There are no such things as stupid questions.  Just my opinion.
>
>
>
> v/r,
>
>
>
> Mike Van
>
>
> ----- Original Message -----
> From: "Kit Plummer [via Karaf]" <ml...@n3.nabble.com>
> To: "Mike Van" <mv...@comcast.net>
> Sent: Monday, November 8, 2010 5:07:36 PM
> Subject: Re: Delay a Start-level?
>
> Ok, sorry for the stupid questions.  How do I get a hold of the ConnectionFactory provided by localhost-broker.xml via a blueprint config?
>
> Kit
>
> On Nov 8, 2010, at 1:42 PM, Guillaume Nodet wrote:
>
>
>> Doesn't the localhost-broker.xml created by default already export a
>> JmsConnectionFactory in the OSGi registry ?
>> If not , you could add it there.
>>
>> Else, I suppose what you do is ok.
>>
>>
>> On Mon, Nov 8, 2010 at 18:58, Kit Plummer < [hidden email] > wrote:
>>>
>>> The broker is loaded by the ActiveMQ feature - I guess by the
>>> localhost-broker.xml config...which is the last thing to load during startup
>>> (after activemq:create-broker --type blueprint is run).  So I don't have a
>>> good way to expose the ConnectionFactory.  I did create a local class that
>>> extends ActiveMQConnectionFactory, and then gets exported in another bundle.
>>> I put a simple loop in the "start" method that spins until a connection is
>>> made.  But, the other bundle that actually is connecting, starts up even
>>> with or without the connection being made.  So I guess the export is
>>> resolved before the "start" method finishes.
>>>
>>> I'm not sure this makes a lot of sense...sorry for that.
>>>
>>> I don't suppose there is some magic blueprint "require" that can be put in
>>> the bean definition?
>>>
>>> Kit
>>> --
>>> View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1864241.html
>>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>
>
>
>
> View message @ http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1865644.html
> To start a new topic under Karaf - User, email ml-node+930749-917263437-228489@n3.nabble.com
> To unsubscribe from Karaf - User, click here .
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1865819.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Delay a Start-level?

Posted by Mike Van <mv...@comcast.net>.


There are no such things as stupid questions.  Just my opinion. 



v/r, 



Mike Van 


----- Original Message ----- 
From: "Kit Plummer [via Karaf]" <ml...@n3.nabble.com> 
To: "Mike Van" <mv...@comcast.net> 
Sent: Monday, November 8, 2010 5:07:36 PM 
Subject: Re: Delay a Start-level? 

Ok, sorry for the stupid questions.  How do I get a hold of the ConnectionFactory provided by localhost-broker.xml via a blueprint config? 

Kit 

On Nov 8, 2010, at 1:42 PM, Guillaume Nodet wrote: 


> Doesn't the localhost-broker.xml created by default already export a 
> JmsConnectionFactory in the OSGi registry ? 
> If not , you could add it there. 
> 
> Else, I suppose what you do is ok. 
> 
> 
> On Mon, Nov 8, 2010 at 18:58, Kit Plummer < [hidden email] > wrote: 
>> 
>> The broker is loaded by the ActiveMQ feature - I guess by the 
>> localhost-broker.xml config...which is the last thing to load during startup 
>> (after activemq:create-broker --type blueprint is run).  So I don't have a 
>> good way to expose the ConnectionFactory.  I did create a local class that 
>> extends ActiveMQConnectionFactory, and then gets exported in another bundle. 
>> I put a simple loop in the "start" method that spins until a connection is 
>> made.  But, the other bundle that actually is connecting, starts up even 
>> with or without the connection being made.  So I guess the export is 
>> resolved before the "start" method finishes. 
>> 
>> I'm not sure this makes a lot of sense...sorry for that. 
>> 
>> I don't suppose there is some magic blueprint "require" that can be put in 
>> the bean definition? 
>> 
>> Kit 
>> -- 
>> View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1864241.html 
>> Sent from the Karaf - User mailing list archive at Nabble.com. 
>> 
> 
> 
> 
> -- 
> Cheers, 
> Guillaume Nodet 
> ------------------------ 
> Blog: http://gnodet.blogspot.com/ 
> ------------------------ 
> Open Source SOA 
> http://fusesource.com 




View message @ http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1865644.html 
To start a new topic under Karaf - User, email ml-node+930749-917263437-228489@n3.nabble.com 
To unsubscribe from Karaf - User, click here . 

-- 
View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1865819.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Delay a Start-level?

Posted by Guillaume Nodet <gn...@gmail.com>.
The simpliest one would be:

    <reference id="connectionFactory" interface="javax.jms.ConnectionFactory" />

This will pick up any JmsConnectionFactory, but you could add an ldap
filter to further filter if needed.

On Mon, Nov 8, 2010 at 23:06, Kit Plummer <ki...@gmail.com> wrote:
> Ok, sorry for the stupid questions.  How do I get a hold of the ConnectionFactory provided by localhost-broker.xml via a blueprint config?
>
> Kit
>
> On Nov 8, 2010, at 1:42 PM, Guillaume Nodet wrote:
>
>> Doesn't the localhost-broker.xml created by default already export a
>> JmsConnectionFactory in the OSGi registry ?
>> If not , you could add it there.
>>
>> Else, I suppose what you do is ok.
>>
>>
>> On Mon, Nov 8, 2010 at 18:58, Kit Plummer <ki...@gmail.com> wrote:
>>>
>>> The broker is loaded by the ActiveMQ feature - I guess by the
>>> localhost-broker.xml config...which is the last thing to load during startup
>>> (after activemq:create-broker --type blueprint is run).  So I don't have a
>>> good way to expose the ConnectionFactory.  I did create a local class that
>>> extends ActiveMQConnectionFactory, and then gets exported in another bundle.
>>> I put a simple loop in the "start" method that spins until a connection is
>>> made.  But, the other bundle that actually is connecting, starts up even
>>> with or without the connection being made.  So I guess the export is
>>> resolved before the "start" method finishes.
>>>
>>> I'm not sure this makes a lot of sense...sorry for that.
>>>
>>> I don't suppose there is some magic blueprint "require" that can be put in
>>> the bean definition?
>>>
>>> Kit
>>> --
>>> View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1864241.html
>>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Delay a Start-level?

Posted by Kit Plummer <ki...@gmail.com>.
Ok, sorry for the stupid questions.  How do I get a hold of the ConnectionFactory provided by localhost-broker.xml via a blueprint config?

Kit

On Nov 8, 2010, at 1:42 PM, Guillaume Nodet wrote:

> Doesn't the localhost-broker.xml created by default already export a
> JmsConnectionFactory in the OSGi registry ?
> If not , you could add it there.
> 
> Else, I suppose what you do is ok.
> 
> 
> On Mon, Nov 8, 2010 at 18:58, Kit Plummer <ki...@gmail.com> wrote:
>> 
>> The broker is loaded by the ActiveMQ feature - I guess by the
>> localhost-broker.xml config...which is the last thing to load during startup
>> (after activemq:create-broker --type blueprint is run).  So I don't have a
>> good way to expose the ConnectionFactory.  I did create a local class that
>> extends ActiveMQConnectionFactory, and then gets exported in another bundle.
>> I put a simple loop in the "start" method that spins until a connection is
>> made.  But, the other bundle that actually is connecting, starts up even
>> with or without the connection being made.  So I guess the export is
>> resolved before the "start" method finishes.
>> 
>> I'm not sure this makes a lot of sense...sorry for that.
>> 
>> I don't suppose there is some magic blueprint "require" that can be put in
>> the bean definition?
>> 
>> Kit
>> --
>> View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1864241.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>> 
> 
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com


Re: Delay a Start-level?

Posted by Guillaume Nodet <gn...@gmail.com>.
Doesn't the localhost-broker.xml created by default already export a
JmsConnectionFactory in the OSGi registry ?
If not , you could add it there.

Else, I suppose what you do is ok.


On Mon, Nov 8, 2010 at 18:58, Kit Plummer <ki...@gmail.com> wrote:
>
> The broker is loaded by the ActiveMQ feature - I guess by the
> localhost-broker.xml config...which is the last thing to load during startup
> (after activemq:create-broker --type blueprint is run).  So I don't have a
> good way to expose the ConnectionFactory.  I did create a local class that
> extends ActiveMQConnectionFactory, and then gets exported in another bundle.
> I put a simple loop in the "start" method that spins until a connection is
> made.  But, the other bundle that actually is connecting, starts up even
> with or without the connection being made.  So I guess the export is
> resolved before the "start" method finishes.
>
> I'm not sure this makes a lot of sense...sorry for that.
>
> I don't suppose there is some magic blueprint "require" that can be put in
> the bean definition?
>
> Kit
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1864241.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Delay a Start-level?

Posted by Kit Plummer <ki...@gmail.com>.
The broker is loaded by the ActiveMQ feature - I guess by the
localhost-broker.xml config...which is the last thing to load during startup
(after activemq:create-broker --type blueprint is run).  So I don't have a
good way to expose the ConnectionFactory.  I did create a local class that
extends ActiveMQConnectionFactory, and then gets exported in another bundle. 
I put a simple loop in the "start" method that spins until a connection is
made.  But, the other bundle that actually is connecting, starts up even
with or without the connection being made.  So I guess the export is
resolved before the "start" method finishes.

I'm not sure this makes a lot of sense...sorry for that.

I don't suppose there is some magic blueprint "require" that can be put in
the bean definition?

Kit
-- 
View this message in context: http://karaf.922171.n3.nabble.com/Delay-a-Start-level-tp1850174p1864241.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Delay a Start-level?

Posted by Guillaume Nodet <gn...@gmail.com>.
If the broker is colocated, then I would do the following:
  * have the broker bundle expose a ConnectionFactory from the same bundle
  * have you client bundles import the ConnectionFactory

This should ensure that the ConnectionFactory will be exported once
the broker is correctly up and running, and the client would wait for
the connection factory to be available, hence the broker too.

On Fri, Nov 5, 2010 at 19:58, Kit Plummer <ki...@gmail.com> wrote:
> I'm currently using Karaf Features (very cool feature) to deploy a suite of bundles.  My feature depends on activemq-blueprint - and subsequently there are services that require the broker to be running to get through their startup methods.
>
> When I start Karaf (everytime) I get a nasty JMSException:
>
> [karaf@root> javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused]
>
> and I'm guessing this is because the broker hasn't finished starting yet.  The broker kicks off at start-level 60, and my bundles at 80 and 85.  Is there a "good" way to handle this?
>
> TIA,
> Kit



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com