activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kitplummer <kitplum...@gmail.com>
Subject Re: is Broker up?
Date Tue, 09 May 2006 16:44:13 GMT


James.Strachan wrote:
> 
> On 5/9/06, kitplummer <kitplummer@gmail.com> wrote:
>> James.Strachan wrote:
>> >
>> > On 5/8/06, kitplummer <kitplummer@gmail.com> wrote:
>> >>
>> >> Is there a good strategy for checking to see if the Broker is up, from
>> >> the
>> >> client side?  I need to keep trying to connect until a connection is
>> >> made...
>> >
>> > How about letting ActiveMQ do that for you?
>> >
>> > http://activemq.org/How+do+I+configure+automatic+reconnection
>> >
>> > you can also register a transport listener to listen for the
>> > connection state if you really want to do stuff manually yourself
>> >
>> >
>> http://activemq.codehaus.org/maven/apidocs/org/apache/activemq/ActiveMQConnection.html#addTransportListener(org.apache.activemq.transport.TransportListener)
>> >
>>
>> I tried the automatic reconnection thing...but, it didn't seem to work if
>> the Broker wasn't available for the initial connection.
> 
> In what way didn't it work? Did it 'hang' is that what you mean? We
> can't connect to a non-existing broker, so all we can do is to keep
> trying to connect. What else could you do?
> 

I get an exception:

javax.jms.JMSException: Could not connect to broker URL:
tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused

Which is what i'd expect.  Here's the URL I passed:

String url = "failover:tcp://localhost:61616";

I have two apps.  The first runs the broker.  The second is a JMS client.  I
need to provide the robustness to allow for the second to start first, and
keep trying to connect until the broker app comes up.

I probably could've explained this better from the get-go...sorry.

FWIW, If I start the broker first, the client second - then kill the broker
- the client crashes...and it doesn't look like it is trying to reconnect. 
Here's the exception:

Caught: javax.jms.JMSException: The transport
tcp://localhost/127.0.0.1:61616 of type:
org.apache.activemq.transport.tcp.TcpTransport is not running.
     [java] javax.jms.JMSException: The transport
tcp://localhost/127.0.0.1:61616 of type:
org.apache.activemq.transport.tcp.TcpTransport is not running.

Kit
--
View this message in context: http://www.nabble.com/is-Broker-up--t1580466.html#a4303776
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message