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 4D59E7B69 for ; Tue, 27 Dec 2011 10:36:40 +0000 (UTC) Received: (qmail 8584 invoked by uid 500); 27 Dec 2011 10:36:39 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 8564 invoked by uid 500); 27 Dec 2011 10:36:39 -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 8556 invoked by uid 99); 27 Dec 2011 10:36:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Dec 2011 10:36:39 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sslavic@gmail.com designates 209.85.213.171 as permitted sender) Received: from [209.85.213.171] (HELO mail-yx0-f171.google.com) (209.85.213.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Dec 2011 10:36:33 +0000 Received: by yenr9 with SMTP id r9so7235827yen.2 for ; Tue, 27 Dec 2011 02:36:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=EsTjzGRTsmfXppyt6gZk2c1WluT9tk/7L54hU+8qlTQ=; b=QP8ei5tAYQeJxC2PiiPkPsD6Fbbv+5y2tmPd2ko+6k7CRNGn1IDn+aJLYcibPbh4Oy uj0b7piaXFRsffUYQi/7RC/jFBQlFqkCfFh52Dl3pceoWp/VsSE/T6rcQbEeEGYcmOf7 AxAdTFdr4SmW9QiTnCWKzqji6aKmdOmWEN8ZE= MIME-Version: 1.0 Received: by 10.236.191.39 with SMTP id f27mr36953488yhn.91.1324982172271; Tue, 27 Dec 2011 02:36:12 -0800 (PST) Received: by 10.100.245.22 with HTTP; Tue, 27 Dec 2011 02:36:12 -0800 (PST) In-Reply-To: References: Date: Tue, 27 Dec 2011 11:36:12 +0100 Message-ID: Subject: Re: Obtaining URLs of ActiveMQ instances From: =?UTF-8?Q?Stevo_Slavi=C4=87?= To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=20cf3040eb0ab643ba04b510739d X-Virus-Checked: Checked by ClamAV on apache.org --20cf3040eb0ab643ba04b510739d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable org.apache.activemq.util.URISupport#isComposite is part of the public API, but has some strange behavior. No javadoc so can not say if it's working according to the contract or not. Last assert in following test fails: package org.apache.activemq.util; import java.net.URI; import java.net.URISyntaxException; import org.apache.activemq.util.URISupport.CompositeData; import org.testng.Assert; import org.testng.annotations.Test; @Test public class URISupportTest { public void testIsCompositeURI() throws URISyntaxException { URI uri =3D new URI("failover://(tcp://foo:61616,tcp://bar:61616)")= ; CompositeData compositeData =3D URISupport.parseComposite(uri); URI[] components =3D compositeData.getComponents(); Assert.assertNotNull(components); Assert.assertEquals(components.length, 2); boolean isComposite =3D URISupport.isCompositeURI(uri); Assert.assertTrue(isComposite); } } On Mon, Dec 19, 2011 at 2:11 PM, Gary Tully wrote: > peek at > org.apache.activemq.transport.failover.FailoverTransportFactory#doConnect > and the use of org.apache.activemq.util.URISupport#parseComposite > and org.apache.activemq.util.URISupport.CompositeData#getComponents > > a failover url with comma separated transport urls is a composite > > On 19 December 2011 13:00, Stevo Slavi=C4=87 wrote: > > Hello ActiveMQ community, > > > > Is there an API in ActiveMQ that can be reused to parse broker URL stri= ng > > and determine URL of each broker? > > > > I have clients (producers and consumers) configured to access two > > master/slave brokers using failover protocol via a property, but would > like > > to get urls of each one of them from the same config property. Need to > > implement checking whether both brokers are masters or both are down an= d > > perform some alarming/notifications about invalid/unexpected state. I c= an > > always implement some custom URL parsing, but would prefer to reuse any > > logic already built in ActiveMQ. > > > > Regards, > > Stevo. > > > > -- > http://fusesource.com > http://blog.garytully.com > --20cf3040eb0ab643ba04b510739d--