You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Torsten Curdt <tc...@apache.org> on 2007/06/13 10:42:41 UTC

discovery

What I am investigation atm is service discovery and consequent inter  
service communication. ActiveMQ with zeroconf for broker discovery  
looks like a good fit for what I am after. So I am playing with  
4.1.1. Doing my first baby steps I thought the following should give  
me a broker and the bus...

     BrokerService broker = new BrokerService();
     broker.setUseJmx(true);
     broker.addConnector("zeroconf://_activemq.broker.development.");
     broker.start();
     	
     	
     ActiveMQConnectionFactory connectionFactory = new  
ActiveMQConnectionFactory("zeroconf://_activemq.broker.development.");

As zeroconf is not included due to the LGPL license I've downloaded  
and now have jmdns in my classpath ...what else is missing?  
"zeroconf" still seems not to be registered yet. Also: IIUC the use  
of zeroconf is deprecated now and one should look into multicast  
instead. But using

     BrokerService broker = new BrokerService();
     broker.setUseJmx(true);
     broker.addConnector("multicast://default");
     broker.start();

as provided in the docs gives me an exception requiring a host and port

  Caught: java.lang.IllegalArgumentException: port out of  
range:-1java.lang.IllegalArgumentException: port out of range:-1
	at java.net.InetSocketAddress.<init>(InetSocketAddress.java:83)
	at java.net.InetSocketAddress.<init>(InetSocketAddress.java:63)
	at org.apache.activemq.transport.udp.UdpTransport.createLocalAddress 
(UdpTransport.java:427)
         ...

But even explicitly giving an address for the multicast group and  
port seems not to work as expected.

     BrokerService broker = new BrokerService();
     broker.setUseJmx(true);
     broker.addConnector("multicast://localhost:8999");
     broker.start();

     ActiveMQConnectionFactory connectionFactory = new  
ActiveMQConnectionFactory("multicast://localhost:8999");

I am getting a bind exception ("address already in use") for this.  
What am I missing?

Also I am not so sure how http://activecluster.codehaus.org fits the  
whole picture yet.

Some wise words would be appreciated :)

cheers
--
Torsten

Re: discovery

Posted by peter royal <pr...@apache.org>.
On Jun 13, 2007, at 5:56 AM, Torsten Curdt wrote:
> How do I register the transport for the URI prefix "zeroconf". I  
> just cannot find how :)

look in org.apache.activemq.transport.discovery.rendezvous

in the META-INF subdir of the jar, there's files that AMQ uses to  
discover what classes to use for various URI prefixes.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi




Re: discovery

Posted by Torsten Curdt <tc...@apache.org>.
On 13.06.2007, at 12:44, James Strachan wrote:

> On 6/13/07, Torsten Curdt <tc...@apache.org> wrote:
>> What I am investigation atm is service discovery and consequent inter
>> service communication. ActiveMQ with zeroconf for broker discovery
>> looks like a good fit for what I am after. So I am playing with
>> 4.1.1. Doing my first baby steps I thought the following should give
>> me a broker and the bus...
>>
>>      BrokerService broker = new BrokerService();
>>      broker.setUseJmx(true);
>>      broker.addConnector("zeroconf://_activemq.broker.development.");
>>      broker.start();
>
> So the broker's connector is TCP; as thats what the clients will use
> to connect to it. Its just a discovery agent is added to advertise
> itself.
>
> Here's an example in XML
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/ 
> resources/org/apache/activemq/usecases/receiver-zeroconf.xml?view=co
>
> i.e. you need to add a ZeroConf based discovery agent.

OK ...but how is that done in code? Probably something along the  
lines of...

            BrokerService broker = new BrokerService();
            broker.setUseJmx(true);
            broker.addConnector("tcp://localhost:61616");
            //broker.addNetworkConnector("zeroconf:// 
_activemq.broker.development.");

            DiscoveryNetworkConnector networkConnector = new  
DiscoveryNetworkConnector();
            networkConnector.setDiscoveryAgent(new  
RendezvousDiscoveryAgent());
            broker.addNetworkConnector(networkConnector);

            //FIXME: howto set "_activemq.broker.development." ?

            broker.start();

How do I register the transport for the URI prefix "zeroconf". I just  
cannot find how :)


>>      ActiveMQConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory("zeroconf:// 
>> _activemq.broker.development.");
>>
>> As zeroconf is not included due to the LGPL license I've downloaded
>> and now have jmdns in my classpath ...what else is missing?
>
> jmdns is Apache licensed now. Its included in lib/optional of the  
> release

Ah ...cool. That should be change here then though:

http://activemq.apache.org/discovery.html

>> "zeroconf" still seems not to be registered yet. Also: IIUC the use
>> of zeroconf is deprecated now and one should look into multicast
>> instead. But using
>>
>>      BrokerService broker = new BrokerService();
>>      broker.setUseJmx(true);
>>      broker.addConnector("multicast://default");
>>      broker.start();
>>
>> as provided in the docs gives me an exception requiring a host and  
>> port
>
> Just out of interest; where in the docs is that example? I'll fix  
> it :)

http://activemq.apache.org/what-is-the-difference-between-discovery- 
multicast-and-zeroconf.html
http://cwiki.apache.org/ACTIVEMQ/discovery-transport-reference.html

cheers
--
Torsten


Re: discovery

Posted by James Strachan <ja...@gmail.com>.
On 6/13/07, Torsten Curdt <tc...@apache.org> wrote:
> What I am investigation atm is service discovery and consequent inter
> service communication. ActiveMQ with zeroconf for broker discovery
> looks like a good fit for what I am after. So I am playing with
> 4.1.1. Doing my first baby steps I thought the following should give
> me a broker and the bus...
>
>      BrokerService broker = new BrokerService();
>      broker.setUseJmx(true);
>      broker.addConnector("zeroconf://_activemq.broker.development.");
>      broker.start();

So the broker's connector is TCP; as thats what the clients will use
to connect to it. Its just a discovery agent is added to advertise
itself.

Here's an example in XML
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/receiver-zeroconf.xml?view=co

i.e. you need to add a ZeroConf based discovery agent.


>      ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("zeroconf://_activemq.broker.development.");
>
> As zeroconf is not included due to the LGPL license I've downloaded
> and now have jmdns in my classpath ...what else is missing?

jmdns is Apache licensed now. Its included in lib/optional of the release


> "zeroconf" still seems not to be registered yet. Also: IIUC the use
> of zeroconf is deprecated now and one should look into multicast
> instead. But using
>
>      BrokerService broker = new BrokerService();
>      broker.setUseJmx(true);
>      broker.addConnector("multicast://default");
>      broker.start();
>
> as provided in the docs gives me an exception requiring a host and port

Just out of interest; where in the docs is that example? I'll fix it :)

The docs in this area were a bit crusty & in some places none existent
:). So I've tried to tidy up a bit. There's a new discovery section at
the bottom of this page
http://cwiki.apache.org/ACTIVEMQ/configuring-transports.html

in particular there's a page on the discovery transport (using our own
multicast discovery agent)
http://cwiki.apache.org/ACTIVEMQ/discovery-transport-reference.html

along with a page on the zeroconf transport
-- 
http://cwiki.apache.org/ACTIVEMQ/zeroconf-transport-reference.html

which also describe how to configure the broker.

James
-------
http://macstrac.blogspot.com/