Is it possible to create socket with multiple outgoing (ingoing) connections using ZeroMQExtensions?

是否可以使用ZeroMQExtensions创建具有多个传出(进入)连接的套接字?

More about multiple connections in ZeroMQ guide.

有关ZeroMQ指南中多个连接的更多信息。

upd: I can't see equavalent sample with ZeroMQExtensions. In 0MQExtensions documnetation i found:

upd:我看不到具有ZeroMQExtensions的等价样本。在0MQExtensions documnetation中,我发现:

newPubSocket(socketParameters: Array[SocketOption]): ActorRef

Java API factory method to create the actor representing the ZeroMQ Publisher socket. You can pass in as many configuration options as you want and the order of the configuration options doesn't matter They are matched on type and the first one found wins.

Java API工厂方法,用于创建表示ZeroMQ Publisher套接字的actor。您可以根据需要传入任意数量的配置选项,配置选项的顺序无关紧要。它们在类型上匹配,第一个找到胜利。

PS: I don't known scala and just started reading akka documentation to understand I need Akka or not.

PS:我不知道scala并且刚开始阅读akka文档以了解我是否需要Akka。

1 个解决方案

#1


0

I found solution (it was not intuitive but works):

我找到了解决方案(它不直观但有效):

    ActorRef subSocket = ZeroMQExtension.get(getContext().system())
            .newSubSocket(null, new Listener(getSelf()), new Subscribe("health"));

    @Override
    public void preStart() {
        super.preStart();

        subSocket.tell(new Connect("tcp://127.0.0.1:1237"));
        subSocket.tell(new Connect("tcp://127.0.0.1:1238"));
    }

更多相关文章

  1. 在网页程序或Java程序中调用接口实现短信猫收发短信的解决方案
  2. javascript(六)js事件绑定浏览器兼容解决方案 attachEvent addEve
  3. java中多线程安全问题产生&解决方案——同步方法

随机推荐

  1. 如何禁用Cell Handsontable中的写入并包
  2. ajax交互Struts2的action(1)
  3. 如何设置动画以使元素围绕圆圈移动?
  4. 通过切换a. localecompare (b) to (ab?1:
  5. 在Angular服务中使用$ http作为json数据
  6. JSON.parse(xhr.responseText)意外的字符串
  7. [jQuery知识]jQuery之知识四-DOM和CSS操
  8. 与jQuery ajax post方法相比,fetch方法没
  9. JavaScript中可见性检查的测试条件
  10. EasyUI-datagrid表格(基本使用)