Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 24722 invoked from network); 8 Feb 2010 16:30:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2010 16:30:58 -0000 Received: (qmail 18406 invoked by uid 500); 8 Feb 2010 16:30:58 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 18339 invoked by uid 500); 8 Feb 2010 16:30:58 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 18321 invoked by uid 99); 8 Feb 2010 16:30:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 16:30:58 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gary.tully@gmail.com designates 209.85.218.228 as permitted sender) Received: from [209.85.218.228] (HELO mail-bw0-f228.google.com) (209.85.218.228) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 16:30:49 +0000 Received: by bwz28 with SMTP id 28so3778334bwz.14 for ; Mon, 08 Feb 2010 08:30:28 -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:content-type; bh=5OmMssTcO2xrt4n3N0RwyM6M3P/DP7pk6EU36NHvUAY=; b=taNuc4ObVHj2Jegg6xH6KF+UoJ6mvN5nd0tsHCIqs0KTLdbuKgaPKT3GdVhOfTVgIl t44fzUO7hCgC9khH+XiUm7JipeUk3PeJNaHoxNXY2bp7d+zRx3hKegy20Jq/ZMHe6sc6 H0odVfzyNlSa8Cc7OCgNCHB1y3OM0jy5vNhzc= 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 :content-type; b=w707Nv6qHL0ei9CJBOv4yY/Z/+cR5J1Ybp3zqs6BMBNXgqL+Pb7/sDWTc0KAL58m/a 4vD/E5jSvEf+a6H3xUzM6eAagp8vmDncBwZfIzc2BXVAJwrJXXRm1sJfer1+3NL60iIJ YO3rNcPcOrMmDe/ceoK0mCSktuRUV5HhQQ0Ew= MIME-Version: 1.0 Received: by 10.204.16.88 with SMTP id n24mr1197894bka.89.1265646628198; Mon, 08 Feb 2010 08:30:28 -0800 (PST) In-Reply-To: <27473153.post@talk.nabble.com> References: <27473153.post@talk.nabble.com> Date: Mon, 8 Feb 2010 16:30:28 +0000 Message-ID: <3a73c17c1002080830iec52e75p9668a36289d4c702@mail.gmail.com> Subject: Re: Broker discovery when no brokers exist still returns a connection factory which cannot be used. From: Gary Tully To: dev@activemq.apache.org Content-Type: multipart/alternative; boundary=0003255597feaf5b43047f1951e7 --0003255597feaf5b43047f1951e7 Content-Type: text/plain; charset=ISO-8859-1 You may wish to raise an enhancement request for this. There is currently no way to block till some broker is discovered. I imagine the best that could be easily achieved is to have start() block till a broker is discovered, with some variable determining the length of the block before an exception is thrown. At teh moment, there is no high level way get notified when a broker is discovered On 5 February 2010 19:58, kjones wrote: > > I'm using ActiveMQ 5.3.0 with a single broker running as a stand-alone app > (not > embedded). > > I have a client consumer app with the following code which finds the broker > through multicast discovery, obtains a connection to it and a session on > it: > > > ActiveMQConnectionFactory connectionFactory = new > > > ActiveMQConnectionFactory("discovery:multicast://default?group=myMessageBroker"); > > ActiveMQConnection msgBrokerConnection = > (ActiveMQConnection)connectionFactory.createConnection(); > > Session msgBrokerSession = msgBrokerConnection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > > > When the broker is running, the above code successfully discovers the > broker, > gets a connection to it and a session on it. > > However, when the broker is not running, the same code still returns an > ActiveMQConnectionFactory and a connection to a non-existent broker. The > subsequent attempt to create a session on this connection fails. > > I would ideally like to have the ActiveMQConnectionFactory return null or > throw > an exception if no brokers are discovered. > > Is there a way to determine when no brokers are discovered? > > Any thoughts are appreciated. > -- > View this message in context: > http://old.nabble.com/Broker-discovery-when-no-brokers-exist-still-returns-a-connection-factory-which-cannot-be-used.-tp27473153p27473153.html > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com. > > -- http://blog.garytully.com Open Source Integration http://fusesource.com --0003255597feaf5b43047f1951e7--