【问题标题】:Setting the HornetQ Embedded-Remote Example设置 HornetQ Embedded-Remote 示例
【发布时间】:2013-05-10 16:10:53
【问题描述】:

我在名为 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();` 

但这会产生下一个异常

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)`

我怎样才能设置这个特定的例子来工作?

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

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

【问题讨论】:

    标签: java jms hornetq


    【解决方案1】:

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

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

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

    这个特定的提交会明确你需要改变什么:

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

    【讨论】:

    • 正是我所需要的,非常感谢您的快速回答和 git commit。
    猜你喜欢
    • 2013-01-25
    • 1970-01-01
    • 2015-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-26
    相关资源
    最近更新 更多