简体   繁体   English

使用IP多播发现正在运行的ActiveMQ消息代理

[英]Discover a running ActiveMQ message broker using IP multicast

The Apache ActiveMQ broker supports discovery with IP multicast . Apache ActiveMQ代理支持通过IP多播进行 发现 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). 我想用其他语言(Delphi / Free Pascal)实现发现功能。 Is there some minimal code example or introduction page on the web which shows how this would be implemented in Java? 网络上是否有一些最小的代码示例或简介页,显示了如何使用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. 如果我理解正确,则多播将触发消息代理的答案,其中包含有关消息代理的IP和端口的信息。 But I can not figure out which port the client needs to specify (ActiveMQ documentation ). 但是我无法弄清楚客户端需要指定哪个端口(ActiveMQ 文档 )。

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. 更新:我找到了http://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html,并尝试使用此示例代码。

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中ActiveMQ的源代码并浏览org.apache.activemq.transports.discovery包,您应该对发现位的工作原理有很好的了解,并且默认端口都在代码中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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