From activemq-users-return-2569-apmail-geronimo-activemq-users-archive=geronimo.apache.org@geronimo.apache.org Wed Jul 05 12:43:47 2006 Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 70231 invoked from network); 5 Jul 2006 12:43:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 12:43:12 -0000 Received: (qmail 4053 invoked by uid 500); 5 Jul 2006 12:41:42 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 91023 invoked by uid 500); 5 Jul 2006 12:40:31 -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 85977 invoked by uid 99); 5 Jul 2006 12:40:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 05:40:04 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of chubrilo@gmail.com designates 66.249.92.175 as permitted sender) Received: from [66.249.92.175] (HELO ug-out-1314.google.com) (66.249.92.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 05:39:45 -0700 Received: by ug-out-1314.google.com with SMTP id c2so2149192ugf for ; Wed, 05 Jul 2006 05:39:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=rNeX6XAV+BXCrxxZuq3Qa01BczGPh3vmLHlEGsYmhmEQyJthnl6D1azSC1RGqH3DmdugsBL9UHDvueQQ/GIcT+GMi+mIyaAT8sCj1tku2WBKOJVT024eKXwIquP7EintCETPfK9V+0V4gSI4CukrLSfcJ0TS6+/OhhJqDnJLWPo= Received: by 10.78.166.7 with SMTP id o7mr2057445hue; Wed, 05 Jul 2006 05:39:13 -0700 (PDT) Received: by 10.78.40.5 with HTTP; Wed, 5 Jul 2006 05:39:13 -0700 (PDT) Message-ID: <36e91d9d0607050539j6606e79cmb8b728996d65c372@mail.gmail.com> Date: Wed, 5 Jul 2006 14:39:13 +0200 From: "Dejan Bosanac" Sender: chubrilo@gmail.com To: activemq-users@geronimo.apache.org Subject: Re: Master-slave client reconnection In-Reply-To: <36e91d9d0607030412y48c26591x1d8df2e1b02e8b7e@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_65581_11419609.1152103153813" References: <36e91d9d0607030404k2657f705p65b6b0bc757eb460@mail.gmail.com> <36e91d9d0607030412y48c26591x1d8df2e1b02e8b7e@mail.gmail.com> X-Google-Sender-Auth: 9a80f74bf39dcf4e X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_65581_11419609.1152103153813 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, after some experiments I found that this problem only exists if there are no other threads in the application. It seems like connection thread dies before it manages to reconnect. By starting another thread in the application, it succeeds to recover from master failure and reconnect to the slave broker. So I have a workaround for now, but it would be nice to make this work even for simple (single-threaded) clients. Regards, Dejan On 7/3/06, Dejan Bosanac wrote: > > Yes, > > here's the URL (with replaced server names) > > > failover://(tcp://master_host:61616,tcp://slave_host:61616)?randomize=false&maxReconnectAttempts=3 > > I've added maxReconnectAttempts parameter later, so it doesn't really > makes any difference. > > If you need any additional details, please let me know. > > Thanks, > Dejan > > > On 7/3/06, James Strachan < james.strachan@gmail.com> wrote: > > > > From your mail I couldn't see the brokerUrl you were using to connect > > using failover to the master and slave. Are you using something like > > the following? > > > > failover:tcp://master:61616,tcp://slave:61616 > > > > > > > > On 7/3/06, Dejan Bosanac < dejan@nighttale.net> wrote: > > > Hi, > > > > > > I'm evaluating ActiveMQ's master-slave configuration in order to make > > my > > > system more robust. > > > I have noted that when I'm using message listeners client does not > > reconnect > > > to slave broker properly (when master broker goes down). > > > Here's the example code: > > > > > > Queue dest = sess.createQueue("test"); > > > MessageConsumer consumer = sess.createConsumer(dest); > > > > > > consumer.setMessageListener(new ClientReceiver()); > > > con.start(); > > > > > > When I stop my master broker, my client dies with the following log > > excerpt: > > > > > > 2006-07-03 12:18:08,262 [7.199.103:61616] DEBUG > > > FailoverTransport - Transport failed, starting up > > reconnect > > > task > > > java.io.EOFException > > > at java.io.DataInputStream.readInt (Unknown Source) > > > at org.apache.activemq.openwire.OpenWireFormat.unmarshal( > > > OpenWireFormat.java:274) > > > at org.apache.activemq.transport.tcp.TcpTransport.run( > > TcpTransport.java > > > :142) > > > at java.lang.Thread.run(Unknown Source) > > > 2006-07-03 12:18:08,262 [ActiveMQ Task ] DEBUG > > > FailoverTransport - Attempting connect to: > > > tcp://master_host:61616 > > > > > > If I change the above example to consume messages directly, like this > > > > > > Queue dest = sess.createQueue("test"); > > > MessageConsumer consumer = sess.createConsumer(dest); > > > > > > con.start(); > > > Message msg = consumer.receive(); > > > > > > everything seems to be working fine: > > > > > > 2006-07-03 12:33:56,335 [7.199.103:61616] DEBUG > > > FailoverTransport - Transport failed, starting up > > reconnect > > > task > > > java.io.EOFException > > > at java.io.DataInputStream.readInt(Unknown Source) > > > at org.apache.activemq.openwire.OpenWireFormat.unmarshal( > > > OpenWireFormat.java:274) > > > at org.apache.activemq.transport.tcp.TcpTransport.run ( > > TcpTransport.java > > > :142) > > > at java.lang.Thread.run(Unknown Source) > > > 2006-07-03 12:33:56,335 [ActiveMQ Task ] DEBUG > > > FailoverTransport - Attempting connect to: > > > tcp://master_host:61616 > > > 2006-07-03 12:33:57,356 [ActiveMQ Task ] DEBUG > > > FailoverTransport - Connect fail to: > > tcp://master_host:61616, > > > reason: java.net.ConnectException: Connection refused: connect > > > 2006-07-03 12:33:57,356 [ActiveMQ Task ] DEBUG > > > FailoverTransport - Attempting connect to: > > > tcp://slave_host:61616 > > > 2006-07-03 12:33:57,366 [ActiveMQ Task ] DEBUG > > > WireFormatNegotiator - Sending: WireFormatInfo { version=1, > > > properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true, > > > SizePrefixDisabled=false, StackTraceEnabled=true, > > > MaxInactivityDuration=30000, CacheEnabled=true}, > > magic=[A,c,t,i,v,e,M,Q]} > > > 2006-07-03 12:33:57,366 [ 47.199.98:61616] DEBUG > > > TcpTransport - TCP consumer thread starting > > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG > > > WireFormatNegotiator - Received WireFormat: WireFormatInfo { > > > > > version=1, properties={StackTraceEnabled=true, > > TightEncodingEnabled=true, > > > TcpNoDelayEnabled=true, SizePrefixDisabled=false, > > > MaxInactivityDuration=30000, CacheEnabled=true}, > > magic=[A,c,t,i,v,e,M,Q]} > > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG > > > WireFormatNegotiator - tcp://slave_host/slave_ip:61616 > > before > > > negotiation: OpenWireFormat{version=1, cacheEnabled=false, > > > stackTraceEnabled=false, tightEncodingEnabled=false, > > > sizePrefixDisabled=false} > > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG > > > WireFormatNegotiator - tcp://slave_host/slave_ip:61616 after > > > negotiation: OpenWireFormat{version=1, cacheEnabled=true, > > > stackTraceEnabled=true, tightEncodingEnabled=true, > > sizePrefixDisabled=false} > > > 2006-07-03 12:33:57,396 [ActiveMQ Task ] DEBUG > > > FailoverTransport - Connection established > > > 2006-07-03 12:33:57,396 [ 47.199.98:61616] DEBUG > > > FailoverTransport - Waking up reconnect task > > > 2006-07-03 12:33:57,396 [47.199.98:61616] DEBUG > > > ResponseCorrelator - Received unexpected response for > > command > > > id: 1 > > > 2006-07-03 12:33:57,406 [47.199.98:61616] DEBUG > > > ResponseCorrelator - Received unexpected response for > > command > > > id: 4 > > > 2006-07-03 12:33:57,547 [47.199.98:61616] DEBUG > > > ResponseCorrelator - Received unexpected response for > > command > > > id: 2 > > > > > > Has anyone else had such experiences and do you know any workarounds? > > > > > > Regards, > > > Dejan > > > > > > > > > > > > -- > > > > James > > ------- > > http://radio.weblogs.com/0112098/ > > > > ------=_Part_65581_11419609.1152103153813--