Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 10635 invoked from network); 16 Feb 2010 16:18:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Feb 2010 16:18:16 -0000 Received: (qmail 51983 invoked by uid 500); 16 Feb 2010 16:18:15 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 51949 invoked by uid 500); 16 Feb 2010 16:18:15 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 51939 invoked by uid 99); 16 Feb 2010 16:18:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2010 16:18:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jlebleu@gmail.com designates 209.85.219.216 as permitted sender) Received: from [209.85.219.216] (HELO mail-ew0-f216.google.com) (209.85.219.216) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2010 16:18:05 +0000 Received: by ewy8 with SMTP id 8so6573371ewy.9 for ; Tue, 16 Feb 2010 08:17:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xMbNkfqjp2cE+I+Xmn/dQidT/LIDGiEWw3exrCQpQ/U=; b=uG9RzvKPhs6FXjEGgrY8Gr6cRdsV86o823m2hrcCH1VU/DKS0DIVENsCPaCKVCN4Pd BaEs6nwSaMvNdEm/QehWasFciDqkMZ6gNw5ieqtcAmEuRri0zBET6B6NUJO1Ilqhx3Ua g5AaActXIx3lpqqr1UCIDl3qhI7Tz9CXuFpl0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BuvefnidPfzvnpnsPEklA/WLnHG5uIwFiv/q572RDcx3RK+6QM2LgFIk5NZLcAFlim XY36DIViGl+ZKLEMBvxgbrSIaZvTyGQas2yguk8QMCK/FUQo1rcA9LWJ/OX2qkR4a1yR S+KpdilMCUyVvMPYk4Tb6WxxCtGJJ4SHELX/8= MIME-Version: 1.0 Received: by 10.213.96.195 with SMTP id i3mr1667397ebn.7.1266337065026; Tue, 16 Feb 2010 08:17:45 -0800 (PST) In-Reply-To: References: Date: Tue, 16 Feb 2010 17:17:44 +0100 Message-ID: Subject: Re: Consumer and Failover From: Jean-Yves LEBLEU To: users@activemq.apache.org Cc: mlemabec@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Feb 16, 2010 at 4:54 PM, James Strachan wrote: > On 16 February 2010 15:38, Jean-Yves LEBLEU wrote: >> Hi all, >> >> I am trying to use the failover transport >> (failover:(tcp://localhost:61618)), and I have some questions : >> >> I did a test with a simple consumer in scala (see the code and log at >> the end of the mail). >> >> Scenario : >> Broker is stopped. >> We start the consumer, it waits >> Start the broker >> Consumer connects and consume messages >> Stop the broker and start the broker again >> Consumer tries 6 times to reconnect and stop working. > > I wonder if you have not restarted the broker in time for the client > to reconnect? How long does the client take to reconnect and how long > is the broker down for? > > Maybe you could try increasing the amount of time the failover > transport waits before failing to connect... > > http://activemq.apache.org/failover-transport-reference.html > > e.g. try this URL > > failover:(tcp://localhost:61618)?maxReconnectAttempts=3D1000 > > > BTW slightly more idiomatic Scala code for onMessage would be... > > def onMessage(message: Message): Unit =3D message match { > =A0case textMessage: TextMessage =3D> =A0println("Message recieved: " + > textMessage.getText()) > =A0case _ =3D> println("Oops, not a text message") > } > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://fusesource.com/ > James, Thanks for the more idiomatic Scala code, we are starting to use scala instead of java and have not explored all the scala subtelties :). I tried with maxReconnectAttempts=3D1000, the consumer stops after 7 attempts to reconnect to the broker. Regards. Jean-Yves