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 72E79979B for ; Wed, 30 Nov 2011 11:20:19 +0000 (UTC) Received: (qmail 54558 invoked by uid 500); 30 Nov 2011 11:20:19 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 54525 invoked by uid 500); 30 Nov 2011 11:20:18 -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 54517 invoked by uid 99); 30 Nov 2011 11:20:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Nov 2011 11:20:18 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tabish121@gmail.com designates 209.85.212.43 as permitted sender) Received: from [209.85.212.43] (HELO mail-vw0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Nov 2011 11:20:12 +0000 Received: by vbbfq11 with SMTP id fq11so255768vbb.2 for ; Wed, 30 Nov 2011 03:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=WGN77uFc4EY31EfRqN24R9vvhIiP9QKnKRw+mgLyLbM=; b=DOuEfAkgTrjxxPeceYDlIs+YJlpHNQJyS9ap8MJMwtNmPKe9uMFythn45gFz3o4Cbx TPcKu/gGhH9dJ4iI7Uc46NSMFW6xQvoUbJBYD+MrsZyP0vusfbQC+bb/4WrPHBNw8lpm B/Or4pE9fOBgP/cRDA+nbysasdYd9usxWO0yo= Received: by 10.52.33.167 with SMTP id s7mr1573429vdi.102.1322651992122; Wed, 30 Nov 2011 03:19:52 -0800 (PST) Received: from [192.168.2.150] (c-98-231-181-148.hsd1.va.comcast.net. [98.231.181.148]) by mx.google.com with ESMTPS id b10sm2159920vdf.7.2011.11.30.03.19.50 (version=SSLv3 cipher=OTHER); Wed, 30 Nov 2011 03:19:50 -0800 (PST) Subject: Re: Do activemq-cpp connection questions. From: Timothy Bish To: users@activemq.apache.org In-Reply-To: <1322612411207-4121275.post@n4.nabble.com> References: <1322583759549-4119766.post@n4.nabble.com> <1322584339.2515.8.camel@OfficePC> <1322595524819-4120510.post@n4.nabble.com> <1322595797.2515.9.camel@OfficePC> <1322612411207-4121275.post@n4.nabble.com> Content-Type: text/plain; charset="UTF-8" Date: Wed, 30 Nov 2011 06:19:49 -0500 Message-ID: <1322651989.2427.0.camel@OfficePC> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit On Tue, 2011-11-29 at 16:20 -0800, JRR wrote: > Hello Tim, > > I am playing with the simple producer and the fail over options. However, I > am not getting the results I expected and I'm hoping you can share some > insights. > > I am using version 3.2.3 of the activemq-cpp library on a SuSE Linux > machine. > > I changed the simple producer example so that the broker URI is: > ---------------------------------------- > std::string brokerURI = > "failover:(tcp://127.0.0.1:61616" > "?initialReconnectDelay=10" > "&maxReconnectDelay=100" > "&useExponentialBackOff=false" > "&maxReconnectAttempts=1" > "&startupMaxReconnectAttempts=1" > "&timeout=100" > ")"; > ---------------------------------------- > > > And I added output to show me the brokerURI and it is as I expected: > ---------------------------------------- > Broker URI: > failover:(tcp://127.0.0.1:61616?initialReconnectDelay=10&maxReconnectDelay=100&useExponentialBackOff=false&maxReconnectAttempts=1&startupMaxReconnectAttempts=1&timeout=100) > ---------------------------------------- > > I wanted to test the scenario when starting the producer when the broker > isn't running. With these setting, my expectation is that it would throw an > exception when the factory created the connection, and I would see the > stack trace (as per the simple example). > > However, what I found is that a connection object is created and returned > (even though the broker is not running), and then the code blocks at the > start() call that follows the connection create. I've confirmed this with > GDB. > > ---------------------------------------- > // Create a Connection > try{ > std::cout << "Connection before " << connection << "\n"; > connection = connectionFactory->createConnection(); > > std::cout << "Connection after " << connection << "\n"; > std::cout << "Connection done. Starting it\n"; > > connection->start(); > > } catch( CMSException& e ) { > e.printStackTrace(); > throw e; > } > std::cout << "Connection start done. Creating Session\n"; > ---------------------------------------- > > > What is the corrrect way to do this? What I want is to use the failover > method, but I don't want to wait forever. If the producer cannot initially > connect, I'd like to eventually timeout and quit. I would suggest that you try the latest version of the client, this could be related to issues that were already fixed. Regards -- Tim Bish ------------ FuseSource Email: tim.bish@fusesource.com Web: http://fusesource.com Twitter: tabish121 Blog: http://timbish.blogspot.com/