是否有任何 ZeroMqChannel 通道超时?

Is there any ZeroMqChannel channel timeout?

我有一个 ZeroMqChannel 对象用于检索数据。由于维护,每周服务都会下线,ZeroMqChannel 实例会保持连接,甚至不会抛出任何异常。

有没有办法抛出超时错误并稍后尝试重新连接?

    @Bean(name = "zeroMqChannel")
    public ZeroMqChannel zeroMqPubSubChannel(ZContext context) {

        ZeroMqChannel channel = new ZeroMqChannel(context, true);
        channel.setConnectUrl(url);
        return channel;
    }

自 v2.1(200?... - 时间过得真快),ZeroMQ-API 弄脏了我的手,
我敢说,
问题出在已经 re-wrapped(有残酷(*) 设计遗漏)ZeroMQ native API 的 re-wrapping(增加了设计妥协)。 =27=]

JeroMQ 文档 (截至 2022 年第一季度,基于 libzmq 4.1.7 说:

TCP KeepAlive Count, Idle, Interval cannot be set via Java but as OS level.


解决方法?

在 native-API 设计中,我们可以很容易地尝试以编程方式 .bind() / .connect() 另一个时间 -"link" 之间的持久性(一个确实,另一个正在切换每周休息),并且已经被 code-designer 认为仍然是 inter-linked ZeroMQ , so as to try if the remote service AccessPoint is actually still indeed alive or if it had gone down, for the said maintenance ( without sending a proper signal to its counterpart. So rude & unfair practice among cooperating agents', isn't it? Fair & smart systems indeed cooperate, even on planned re-configuration, before disconnecting from peer(s) - this is why ZeroMQ messaging + signalling meta-plane designs are so cute to make distributed-computing robust & smart in production, isn't it? I dare to imagine, how many distributed-FSA REQ/REP 案例中发生这种 rude-mode)。

细节很重要,取决于 re-wrapped 本机 ZeroMQ API 的 re-wrapping。那里我们可以有一个 PUB/SUB-link 操作尽可能多的 "co-parallel"-links,设置 & torn-down on-the-fly (使用失败尝试设置一个新工具作为 self-diagnosing 工具来检测无法连接的远程 AccessNode 并为我们提供服务 side-effect。

这一切都取决于包装器的实际设计。本机 API 甚至提供 socket-monitor,可以以清晰合理的方式解决部分问题,但不确定是否已在 JeroMQ 和 Spring-integration 包装器中实现。

ZeroMQ re-wrapping 的记录 Zen-of-Zero 高度抽象,但在内部 super-inconsistent,“适配器”细节让我感到困惑,警告我要非常小心我们从中丢失的其他东西聪明的原创如果使用它:

The ZeroMqChannel is a SubscribableChannel which uses a pair of ZeroMQ sockets to connect publishers and subscribers for messaging interaction. It can work in a PUB/SUB mode (defaults to PUSH/PULL); it can also be used as a local inter-thread channel (uses PAIR sockets)

*)

  • no ipc:// transport-class(通过 tcp://loopback-port 模拟)
  • 没有 pgm:// transport-class
  • 无规范://transport-class
  • 没有tipc://transport-class
  • ...
  • PUB/SUB 过滤,基于 TOPIC,可能但不一定如此,由发件人 re-configured 进入 multi-frame 消息(即不知情或不参与由任何潜在的许多人控制 SUB-side(s) )
  • “变色龙”-类似于 (re-wrapped) 智能 ZeroMQ 可扩展正式通信模式原型的类型,现在原始 PUB/SUB 突然变得 PUSH/PULL,所有“行为”都发生了变化-模式。这对我来说很难被认为是进行系统设计的积极因素(恕我直言,爬行属性没有任何好处 - 新用户会迷路,因为从未见过 native-API 原始的智能和功能,有经验的用户会因为所有智能功能而感到恐慌native-API 不工作 as-is,但得到 re-dressed 混合最初 super-clean,性能优化概念,混合 { PUSH/PULL | PUB/SUB }-mutable-mezzo-types 容易出错在 re-use 中,在其他经典和稳定的 use-case 模式中,导致进一步的概念遗漏和隐藏 design-compromises 只是这种混合和流动景观造成的一些损失)
  • 还有更多