On 13.06.2007, at 12:44, James Strachan wrote:
On 6/13/07, Torsten Curdt <[EMAIL PROTECTED]> 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