设置HornetQ嵌入式远程示例

Dgu*_*uel 4 java jms hornetq

我在一个名为Embedded-Remote的核心文件夹下的hornetq-2.3.0.Final jar中设置示例有一些麻烦,我试图在"远程环境"中运行该示例,用于同一LAN中的这两台计算机,如果我在同一台计算机上运行这两个类而不更改任何内容"EmbeddedRemotExample.java"运行正常,但由于此示例缺少配置文件,我不确定如何设置此类以连接到另一台计算机上运行的服务器.阅读api我发现这是一个有效的代码:

`

     HashMap map = new HashMap();
     map.put("host", "192.168.XXX.XXX");
     map.put("port", 5445);
     ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(
         new TransportConfiguration(NettyConnectorFactory.class.getName(),map));
     ClientSessionFactory sf = serverLocator.createSessionFactory();` 
Run Code Online (Sandbox Code Playgroud)

但这会产生下一个例外

HornetQException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:852)
at org.hornetq.core.example.EmbeddedRemoteExample.main(EmbeddedRemoteExample.java:49)`
Run Code Online (Sandbox Code Playgroud)

我怎么能设置这个具体的例子?

在一台计算机中:org.hornetq.core.example.EmbeddedServer

在另一个:org.hornetq.core.example.EmbeddedRemoteExample

Fra*_*sco 5

您需要将相同的配置添加到服务器的Acceptor中EmbeddedServer.java.默认情况下,它将设置为localhost.

我认为该示例需要清理代码:

https://github.com/hornetq/hornetq/pull/1062

此特定提交将明确您需要更改的内容:

https://github.com/FranciscoBorges/hornetq/commit/fbed7e8394c843e4528df90d4c2ef155a7d032c0