activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stevo Slavić <ssla...@gmail.com>
Subject Re: Obtaining URLs of ActiveMQ instances
Date Tue, 27 Dec 2011 10:36:12 GMT
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 = new URI("failover://(tcp://foo:61616,tcp://bar:61616)");
        CompositeData compositeData = URISupport.parseComposite(uri);
        URI[] components = compositeData.getComponents();
        Assert.assertNotNull(components);
        Assert.assertEquals(components.length, 2);

        boolean isComposite = URISupport.isCompositeURI(uri);
        Assert.assertTrue(isComposite);
    }
}




On Mon, Dec 19, 2011 at 2:11 PM, Gary Tully <gary.tully@gmail.com> 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ć <sslavic@gmail.com> wrote:
> > Hello ActiveMQ community,
> >
> > Is there an API in ActiveMQ that can be reused to parse broker URL string
> > 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 and
> > perform some alarming/notifications about invalid/unexpected state. I can
> > 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message