简体   繁体   中英

Discover a running ActiveMQ message broker using IP multicast

The Apache ActiveMQ broker supports discovery with IP multicast . This feature is activated in the default 'demo' configuration (see below). I would like to implement the discovery feature in other languages (Delphi / Free Pascal). Is there some minimal code example or introduction page on the web which shows how this would be implemented in Java?

If I understand correctly, the multicast would trigger an answer of the message broker, which contains information about IP and port of the message broker. But I can not figure out which port the client needs to specify (ActiveMQ documentation ).

However I can not see which port the multicast client should use.

<!-- Create a TCP transport that is advertised on via an IP multicast
              group named default. -->
  <transportConnector name="openwire" uri="tcp://localhost:61616"
                      discoveryUri="multicast://default"/>
  ...

Update: I found http://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html and try to use this example code.

The best source of documentation is always the code itself. If you take a look at the source in SVN for ActiveMQ and browse the org.apache.activemq.transports.discovery package you should have a really good understanding of how the discovery bits works, also the default ports are all in the code.

svn co https://svn.apache.org/repos/asf/activemq/trunk activemq

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM