Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D00209C66 for ; Tue, 17 Apr 2012 10:41:43 +0000 (UTC) Received: (qmail 34604 invoked by uid 500); 17 Apr 2012 10:41:43 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 34573 invoked by uid 500); 17 Apr 2012 10:41:43 -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 34563 invoked by uid 99); 17 Apr 2012 10:41:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Apr 2012 10:41:43 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jbrook@upcbroadband.com designates 62.179.123.10 as permitted sender) Received: from [62.179.123.10] (HELO mail4.upc.biz) (62.179.123.10) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Apr 2012 10:41:37 +0000 Received: from AMS2PMS805.upcit.ds.upc.biz (172.16.72.135) by AMS2PMS712.GAL-ENTERPRISE.UPC.BIZ (172.16.73.23) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 17 Apr 2012 12:41:13 +0200 Received: from AMS2PMS4001.upcit.ds.upc.biz ([172.16.72.139]) by AMS2PMS805.upcit.ds.upc.biz ([172.16.72.135]) with mapi; Tue, 17 Apr 2012 12:41:15 +0200 From: "Brook, James" To: "users@activemq.apache.org" Date: Tue, 17 Apr 2012 12:41:10 +0200 Subject: Re: Producer blocks when trying to send async JMS messages to failed broker Thread-Topic: Producer blocks when trying to send async JMS messages to failed broker Thread-Index: Ac0chpzTBjFrXoLgRK24kt+ROf/S+A== Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Thanks Gary. I am still not completely sure I get it. I am using failover b= ecause I *do* want my client to reconnect when the broker comes back up. Ho= wever, when it's down I don't want to queue messages or block anything - th= ey can be thrown away. My messages really are 'fire and forget'. These lose= their meaning if not delivered to their ultimate destination within 2 seco= nds or so. My expectation was that I would be able to asynchronously send messages and= never block. I have tried using non-persistent messages, and telling the t= ransport not to track messages. If I do what you suggest won't the failover transport wait 10ms, try to rec= onnect once and then give up forever? Wouldn't that mean someone has to tak= e manual action to reestablish the connection? Sorry if I am missing the point.=20 On Apr 17, 2012, at 12:32 PM, Gary Tully wrote: > configure the failover maxReconnectAttempts and the failure to connect > will bubble up to the application where you can ignore it. > The assumption of failover is that you want to 'transparently' > maintain the connection and block pending reconnect >=20 > failover:(...)? maxReconnectAttempts=3D1 >=20 > http://activemq.apache.org/failover-transport-reference.html >=20 > On 16 April 2012 19:52, Brook, James wrote: >> I am trying to make sure my application is resilient. It sends JMS messa= ges to a remote ActiveMQ broker. Unfortunately when that broker goes down t= he client starts to block even though I am using the Camel asyncSendBody me= thod. See below for the stack trace. >>=20 >> The ActiveMQ version is 5.3.0 although I have the same problem with the = most recent stable release. >>=20 >> This is the argument I give to the asyncSendBody method: >>=20 >> jms:queue:myQueue?jmsMessageType=3DText&timeToLive=3D5000 >>=20 >> My connection factory uses this URL: >>=20 >> failover:(tcp://my.ip:61613,tcp://my:ip:61613)?useExponentialBackOff= =3Dtrue&randomize=3Dfalse&timeout=3D1000 >>=20 >> As the broker starts to fail I see lots of the following errors in the l= og: >>=20 >> org.apache.camel.processor.UnitOfWorkProcessor - Caught unhandled ex= ception while processing ExchangeId: ID-james-upcit-ds-upc-biz-64404-133460= 1186430-0-38 >> IOException: Failover timeout of 1000 ms reached >>=20 >> org.apache.activemq.transport.failover.FailoverTransport - Failover t= imed out after 29998ms >>=20 >> Then after attempting to send quite a few more messages the blocking sta= rts. I can't go live with my application in this state and I really don't w= ant to put another queue in place to decouple the JMS producer. Is there so= mething I am doing wrong? If the broker is down I am quite happy for these = messages to be lost - they lose their meaning if not delivered immediately. >>=20 >> Thanks >> James >>=20 >> at java.lang.Object.wait(Native Method) >> at org.apache.activemq.transport.failover.FailoverTransport.onewa= y(FailoverTransport.java:433) >> at org.apache.activemq.transport.MutexTransport.oneway(MutexTrans= port.java:40) >> at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(= ResponseCorrelator.java:74) >> at org.apache.activemq.transport.ResponseCorrelator.request(Respo= nseCorrelator.java:79) >> at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQ= Connection.java:1244) >> at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSen= t(ActiveMQConnection.java:1350) >> at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQC= onnection.java:300) >> at org.springframework.jms.support.JmsAccessor.createSession(JmsA= ccessor.java:196) >> at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.j= ava:457) >> at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTempla= te.send(JmsConfiguration.java:185) >> at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.= java:359) >> at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsPr= oducer.java:313) >> at org.apache.camel.component.jms.JmsProducer.process(JmsProducer= .java:111) >> at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(Un= itOfWorkProcessor.java:150) >> at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfW= orkProcessor.java:117) >> at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProces= sorHelper.java:99) >> at org.apache.camel.processor.DelegateAsyncProcessor.process(Dele= gateAsyncProcessor.java:86) >> at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWo= rkProducer.java:63) >> at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCac= he.java:352) >> at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCac= he.java:324) >> at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache= .java:223) >> at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache= .java:324) >> at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:16= 9) >> at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProd= ucerTemplate.java:111) >> at org.apache.camel.impl.DefaultProducerTemplate.sendBody(Default= ProducerTemplate.java:124) >> at org.apache.camel.impl.DefaultProducerTemplate$14.call(DefaultP= roducerTemplate.java:596) >> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:= 303) >> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >> at java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejec= tedExecution(ThreadPoolExecutor.java:1746) >> at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecu= tor.java:767) >> at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExec= utor.java:658) >> at java.util.concurrent.AbstractExecutorService.submit(AbstractEx= ecutorService.java:92) >> at org.apache.camel.impl.DefaultProducerTemplate.asyncSendBody(De= faultProducerTemplate.java:601) >> at org.apache.camel.impl.DefaultProducerTemplate.asyncSendBody(De= faultProducerTemplate.java:458) >=20 >=20 >=20 > --=20 > http://fusesource.com > http://blog.garytully.com