Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 85467 invoked from network); 9 May 2006 16:44:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 May 2006 16:44:45 -0000 Received: (qmail 60374 invoked by uid 500); 9 May 2006 16:44:38 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 60361 invoked by uid 500); 9 May 2006 16:44:38 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 60352 invoked by uid 99); 9 May 2006 16:44:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 09:44:38 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of lists@nabble.com designates 72.21.53.35 as permitted sender) Received: from [72.21.53.35] (HELO talk.nabble.com) (72.21.53.35) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 09:44:36 -0700 Received: from localhost ([127.0.0.1] helo=talk.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1FdVJl-0003on-Mo for activemq-users@geronimo.apache.org; Tue, 09 May 2006 09:44:14 -0700 Message-ID: <4303776.post@talk.nabble.com> Date: Tue, 9 May 2006 09:44:13 -0700 (PDT) From: kitplummer To: activemq-users@geronimo.apache.org Subject: Re: is Broker up? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-Sender: kitplummer@gmail.com X-Nabble-From: kitplummer References: <4290117.post@talk.nabble.com> <4303116.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N James.Strachan wrote: > > On 5/9/06, kitplummer wrote: >> James.Strachan wrote: >> > >> > On 5/8/06, kitplummer 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.