You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by BigPic <na...@jgro.net> on 2009/01/08 03:12:28 UTC

Multicast Discovery not working

I'm using ActiveMQ 5.2.0 but I can't get clients to discover the broker.  My
goal is to run a single broker with multiple clients all auto-discovering
it.     

I have the broker config:

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default?group=test"/>
         </transportConnectors>

and the broker is running on a Win2K system.

Then on another system (Win XP SP3), I have a Java 1.5 client:

        String brokerUrl =
"discovery:(multicast://default)?group=test&maxReconnectAttempts=2";
        ActiveMQConnectionFactory connectionFactory =
                	new ActiveMQConnectionFactory(brokerUrl);


But the client just gives me:

ERROR: org.apache.activemq.transport.failover.FailoverTransport - Failed to
connect to transport after: 2 attempt(s)
Caught: javax.jms.JMSException: No uris available to connect to.


Now if I change the brokerUrl to "tcp://192.168.1.2:61616" (using the IP
address of the broker machine) it works fine.  


I've read  http://activemq.apache.org/discovery-transport-reference.html 
The Discovery Transport Reference  and a few other pages but I haven't found
anything that would help me debug this.  I tried removing the "group" id but
that didn't help.  I'm at a loss for what to try next.

Can anyone suggest a way for me to move forward with this?  

Thanks.

-- 
View this message in context: http://www.nabble.com/Multicast-Discovery-not-working-tp21344587p21344587.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Multicast Discovery not working

Posted by BigPic <na...@jgro.net>.
I opened JIRA issue   http://issues.apache.org/activemq/browse/AMQ-2080
AMQ-2080  per your request for #3.

I did NOT open one for #2 because it's not clear to me how that should work. 
I mean, it's not clear to me what's going on, because there is a significant
delay between the time the discovery agent is started and the time it
discovers a broker, and it wouldn't be right to block on the discovery agent
waiting for it to discover a broker.  There's a good chance the code there
is working fine, but I was confused because of the underlying problem of
initialReconnectDelay not being honored which colored my thinking.  I had
tried 2 reconnects with a delay of 10000000ms and found it still returned
immediately and thought that was a bug in the discovery agent startup
sequence rather than what I now think it is which is a more global problem
with the delay not being honored.



Gary Tully wrote:
> 
> can you raise a jira issue[1] for #3 and possibly #2 as the initiator
> of the discovery should wait for it to start imho.
> 
> [1]
> http://activemq.apache.org/contributing.html#Contributing-Ifyoufindabugorproblem
> 
> 2009/1/15 BigPic <na...@jgro.net>:
>>
>>
>> BigPic wrote:
>>>
>>> I'm using ActiveMQ 5.2.0 but I can't get clients to discover the broker.
>>> My goal is to run a single broker with multiple clients all
>>> auto-discovering it.
>>>
>>> I have the broker config:
>>>
>>>         <transportConnectors>
>>>             <transportConnector name="openwire"
>>> uri="tcp://localhost:61616"
>>> discoveryUri="multicast://default?group=test"/>
>>>          </transportConnectors>
>>>
>>> and the broker is running on a Win2K system.
>>>
>>> Then on another system (Win XP SP3), I have a Java 1.5 client:
>>>
>>>         String brokerUrl =
>>> "discovery:(multicast://default)?group=test&maxReconnectAttempts=2";
>>>         ActiveMQConnectionFactory connectionFactory =
>>>                       new ActiveMQConnectionFactory(brokerUrl);
>>>
>>>
>>
>> OK, found a few problems.  #1 is that the client broker URL should be
>>
>>        String brokerUrl =
>> "discovery:(multicast://default?group=test)?maxReconnectAttempts=2";
>>
>> #2 is that it appears the discovery agent isn't started until the first
>> connection attempt and the connection attempt does not in any way wait
>> for
>> the discovery agent to be started before trying to connect, so the 2
>> reconnection attempts pass before the discovery agent discovers the
>> broker.
>>
>> #3 is definitely a bug.  If I use
>>
>>       String brokerUrl =
>> "discovery:(multicast://default?group=test)?maxReconnectAttempts=30&initialReconnectDelay=1000&useExponentialBackOff=false";
>>
>> the connection still fails, and in far less than the 30 seconds that
>> should
>> be necessary to do 30 attempts with a 1000 ms (= 1 second) delay between
>> attempts.  To get a connection I need to have at least 10 reconnect
>> attempts
>> and set useExponentialBackOff=true.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multicast-Discovery-not-working-tp21344587p21571951.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Multicast Discovery not working

Posted by Gary Tully <ga...@gmail.com>.
can you raise a jira issue[1] for #3 and possibly #2 as the initiator
of the discovery should wait for it to start imho.

[1] http://activemq.apache.org/contributing.html#Contributing-Ifyoufindabugorproblem

2009/1/15 BigPic <na...@jgro.net>:
>
>
> BigPic wrote:
>>
>> I'm using ActiveMQ 5.2.0 but I can't get clients to discover the broker.
>> My goal is to run a single broker with multiple clients all
>> auto-discovering it.
>>
>> I have the broker config:
>>
>>         <transportConnectors>
>>             <transportConnector name="openwire"
>> uri="tcp://localhost:61616"
>> discoveryUri="multicast://default?group=test"/>
>>          </transportConnectors>
>>
>> and the broker is running on a Win2K system.
>>
>> Then on another system (Win XP SP3), I have a Java 1.5 client:
>>
>>         String brokerUrl =
>> "discovery:(multicast://default)?group=test&maxReconnectAttempts=2";
>>         ActiveMQConnectionFactory connectionFactory =
>>                       new ActiveMQConnectionFactory(brokerUrl);
>>
>>
>
> OK, found a few problems.  #1 is that the client broker URL should be
>
>        String brokerUrl =
> "discovery:(multicast://default?group=test)?maxReconnectAttempts=2";
>
> #2 is that it appears the discovery agent isn't started until the first
> connection attempt and the connection attempt does not in any way wait for
> the discovery agent to be started before trying to connect, so the 2
> reconnection attempts pass before the discovery agent discovers the broker.
>
> #3 is definitely a bug.  If I use
>
>       String brokerUrl =
> "discovery:(multicast://default?group=test)?maxReconnectAttempts=30&initialReconnectDelay=1000&useExponentialBackOff=false";
>
> the connection still fails, and in far less than the 30 seconds that should
> be necessary to do 30 attempts with a 1000 ms (= 1 second) delay between
> attempts.  To get a connection I need to have at least 10 reconnect attempts
> and set useExponentialBackOff=true.
>
>
>
> --
> View this message in context: http://www.nabble.com/Multicast-Discovery-not-working-tp21344587p21484957.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source SOA
http://FUSESource.com

Re: Multicast Discovery not working

Posted by BigPic <na...@jgro.net>.

BigPic wrote:
> 
> I'm using ActiveMQ 5.2.0 but I can't get clients to discover the broker. 
> My goal is to run a single broker with multiple clients all
> auto-discovering it.     
> 
> I have the broker config:
> 
>         <transportConnectors>
>             <transportConnector name="openwire"
> uri="tcp://localhost:61616"
> discoveryUri="multicast://default?group=test"/>
>          </transportConnectors>
> 
> and the broker is running on a Win2K system.
> 
> Then on another system (Win XP SP3), I have a Java 1.5 client:
> 
>         String brokerUrl =
> "discovery:(multicast://default)?group=test&maxReconnectAttempts=2";
>         ActiveMQConnectionFactory connectionFactory =
>                 	new ActiveMQConnectionFactory(brokerUrl);
> 
> 

OK, found a few problems.  #1 is that the client broker URL should be 

        String brokerUrl =
"discovery:(multicast://default?group=test)?maxReconnectAttempts=2";

#2 is that it appears the discovery agent isn't started until the first
connection attempt and the connection attempt does not in any way wait for
the discovery agent to be started before trying to connect, so the 2
reconnection attempts pass before the discovery agent discovers the broker.

#3 is definitely a bug.  If I use 

       String brokerUrl =
"discovery:(multicast://default?group=test)?maxReconnectAttempts=30&initialReconnectDelay=1000&useExponentialBackOff=false";

the connection still fails, and in far less than the 30 seconds that should
be necessary to do 30 attempts with a 1000 ms (= 1 second) delay between
attempts.  To get a connection I need to have at least 10 reconnect attempts
and set useExponentialBackOff=true.  



-- 
View this message in context: http://www.nabble.com/Multicast-Discovery-not-working-tp21344587p21484957.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Multicast Discovery not working

Posted by Gary Tully <ga...@gmail.com>.
check out the tests for this feature to see a url paring that works,
they use a slightly more low level internal api but should provide
what you need.
I notice that there are no brackets used in the client side brokerUrl, see:

http://activemq.apache.org/maven/5.2.0/activemq-core/testapidocs/src-html/org/apache/activemq/transport/discovery/DiscoveryTransportBrokerTest.html#line.146

there are a few variants at:
http://activemq.apache.org/maven/5.2.0/activemq-core/testapidocs/org/apache/activemq/transport/discovery/package-summary.html

2009/1/8 BigPic <na...@jgro.net>:
>
> I'm using ActiveMQ 5.2.0 but I can't get clients to discover the broker.  My
> goal is to run a single broker with multiple clients all auto-discovering
> it.
>
> I have the broker config:
>
>        <transportConnectors>
>            <transportConnector name="openwire" uri="tcp://localhost:61616"
> discoveryUri="multicast://default?group=test"/>
>         </transportConnectors>
>
> and the broker is running on a Win2K system.
>
> Then on another system (Win XP SP3), I have a Java 1.5 client:
>
>        String brokerUrl =
> "discovery:(multicast://default)?group=test&maxReconnectAttempts=2";
>        ActiveMQConnectionFactory connectionFactory =
>                        new ActiveMQConnectionFactory(brokerUrl);
>
>
> But the client just gives me:
>
> ERROR: org.apache.activemq.transport.failover.FailoverTransport - Failed to
> connect to transport after: 2 attempt(s)
> Caught: javax.jms.JMSException: No uris available to connect to.
>
>
> Now if I change the brokerUrl to "tcp://192.168.1.2:61616" (using the IP
> address of the broker machine) it works fine.
>
>
> I've read  http://activemq.apache.org/discovery-transport-reference.html
> The Discovery Transport Reference  and a few other pages but I haven't found
> anything that would help me debug this.  I tried removing the "group" id but
> that didn't help.  I'm at a loss for what to try next.
>
> Can anyone suggest a way for me to move forward with this?
>
> Thanks.
>
> --
> View this message in context: http://www.nabble.com/Multicast-Discovery-not-working-tp21344587p21344587.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source SOA
http://FUSESource.com

Re: Multicast Discovery not working

Posted by BigPic <na...@jgro.net>.
Note, I can't get rendezvous to work either.

 <transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="rendezvous://test"/>

        String brokerUrl =
"discovery:(rendezvous://test)?maxReconnectAttempts=2";
        ActiveMQConnectionFactory connectionFactory =
                	new ActiveMQConnectionFactory(brokerUrl);


However in this case I can at least see (using jmDNS) that there is in fact
an entry for _test.ActiveMQ-4. which contains the correct broker URL.  

I can also put a breakpoint at FailoverTransport.add(URI u[]) and see that
the correct URI is being added, namely "tcp://hostname:61616" which, if I
configure directly into the ActiveMQConnectionFactory works.  

So this is looking like a bug to me.


BigPic wrote:
> 
> I'm using ActiveMQ 5.2.0 but I can't get clients to discover the broker. 
> My goal is to run a single broker with multiple clients all
> auto-discovering it.     
> 
> I have the broker config:
> 
>         <transportConnectors>
>             <transportConnector name="openwire"
> uri="tcp://localhost:61616"
> discoveryUri="multicast://default?group=test"/>
>          </transportConnectors>
> 
> and the broker is running on a Win2K system.
> 
> Then on another system (Win XP SP3), I have a Java 1.5 client:
> 
>         String brokerUrl =
> "discovery:(multicast://default)?group=test&maxReconnectAttempts=2";
>         ActiveMQConnectionFactory connectionFactory =
>                 	new ActiveMQConnectionFactory(brokerUrl);
> 
> 
> But the client just gives me:
> 
> ERROR: org.apache.activemq.transport.failover.FailoverTransport - Failed
> to connect to transport after: 2 attempt(s)
> Caught: javax.jms.JMSException: No uris available to connect to.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multicast-Discovery-not-working-tp21344587p21346016.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.