Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 57713 invoked from network); 26 Apr 2010 16:19:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Apr 2010 16:19:42 -0000 Received: (qmail 91789 invoked by uid 500); 26 Apr 2010 16:19:41 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 91679 invoked by uid 500); 26 Apr 2010 16:19:41 -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 91671 invoked by uid 99); 26 Apr 2010 16:19:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 16:19:41 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 16:19:35 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1O6R1e-0007O7-Pn for users@activemq.apache.org; Mon, 26 Apr 2010 09:19:14 -0700 Message-ID: <28366993.post@talk.nabble.com> Date: Mon, 26 Apr 2010 09:19:14 -0700 (PDT) From: Kalpana Jalawadi To: users@activemq.apache.org Subject: Re: Using FailoverTransport In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: kalpana.jalawadi@gmail.com References: <28338986.post@talk.nabble.com> <28348889.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Thank you so much for the test case example! Gary Tully wrote: > > No need to reference the FailoverTransportFactory, it is easier than you > think, read again Dejan's reply and have a look at one of the tests for > the > failover feature: > http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerTest.java?view=markup > > On 24 April 2010 09:43, Kalpana Jalawadi > wrote: > >> >> Hi, >> Thanks for the reply. >> Below is the code snippet I'm using, kindly check if this is the right >> way. >> >> try { >> failoverTransportFactory = new FailoverTransportFactory(); >> >> Map params = new HashMap> String>(); >> failoverTransport = >> failoverTransportFactory.createTransport(params); >> failoverTransport.add("tcp://localhost:61616"); >> failoverTransport.setTransportListener(new Listener()); >> failoverTransport.setMaxReconnectAttempts(1000); >> failoverTransport.setReconnectDelay(15000); >> failoverTransport.setUseExponentialBackOff(true); >> failoverTransport.setTimeout(3600000); >> failoverTransport.start(); >> >> connectionFactory = new ActiveMQConnectionFactory(null, >> null, "tcp://192.168.150.46:61616"); >> connection = (ActiveMQConnection) >> PubSubClient.connectionFactory.createConnection(); >> connection.setClientID(clientId); >> connection.setExceptionListener(new ExceptionHandler()); >> connection.start(); >> >> session = connection.createSession(false, >> Session.AUTO_ACKNOWLEDGE); >> topic = (ActiveMQTopic) session.createTopic(topicName); >> } catch (InterruptedIOException e) { >> e.printStackTrace(); >> } catch (Exception e) { >> e.printStackTrace(); >> } >> >> According to my understanding, Failovertransport, is basically >> establishing >> a reliable transport connection to the JMS provider. In the event of any >> problem at the provider, the client gets notified. And then, rest of the >> job >> of creating a connection, session remains the same. >> >> Thank you! >> >> >> >> Dejan Bosanac wrote: >> > >> > Hi, >> > >> > you the normal JMS code for that (find any JMS tutorial on the topic). >> The >> > only thing that is different in failover case is broker url you use >> > (e.g >> failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false) >> > >> > See >> > http://activemq.apache.org/failover-transport-reference.htm< >> http://activemq.apache.org/failover-transport-reference.html>l >> > for more info. >> > >> > Cheers >> > -- >> > Dejan Bosanac - http://twitter.com/dejanb >> > >> > Open Source Integration - http://fusesource.com/ >> > ActiveMQ in Action - http://www.manning.com/snyder/ >> > Blog - http://www.nighttale.net >> > >> > >> > On Fri, Apr 23, 2010 at 11:32 AM, Kalpana Jalawadi < >> > kalpana.jalawadi@gmail.com> wrote: >> > >> >> >> >> Hi, >> >> Could anybody post a code snippet for acquiring a connection & session >> >> over >> >> a FailoverTransport. >> >> >> >> Thanks in advance. >> >> -- >> >> View this message in context: >> >> http://old.nabble.com/Using-FailoverTransport-tp28338986p28338986.html >> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. >> >> >> >> >> > >> > >> > ----- >> > Dejan Bosanac >> > >> > Open Source Integration - http://fusesource.com/ >> > ActiveMQ in Action - http://www.manning.com/snyder/ >> > Blog - http://www.nighttale.net >> > >> >> -- >> View this message in context: >> http://old.nabble.com/Using-FailoverTransport-tp28338986p28348889.html >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. >> >> > > > -- > http://blog.garytully.com > > Open Source Integration > http://fusesource.com > > -- View this message in context: http://old.nabble.com/Using-FailoverTransport-tp28338986p28366993.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.