如何获取ZMQ_PUB服务的数据?

How to get data a ZMQ_PUB service?

发布者服务可以从外部源接收数据并将它们发送给订阅者吗?

wuserver.cpp 示例中,数据是从同一脚本生成的。

我可以编写一个 ZMQ_PUBLISHER 实体,它从外部数据源/应用程序接收数据...吗?

在此肯定:

There is one more important thing to know about PUB-SUB sockets: you do not know precisely when a subscriber starts to get messages. Even if you start a subscriber, wait a while, and then start the publisher, the subscriber will always miss the first messages that the publisher sends. This is because as the subscriber connects to the publisher (something that takes a small but non-zero time), the publisher may already be sending messages out.

这是否意味着 PUB-SUB ZeroMQ 模式已尽最大努力执行 - UDP 样式?

Q1:
Can I write a ZMQ_PUBLISHER entity, which receives data from external data source/application?

A1:哦,当然,这就是为什么 ZeroMQ 如此帮助我们设计智能 . Just imagine the PUB-side process to also have other { .bind() | .connect() }-calls, so as to establish such other links to data-feeder(s), and you are done to operate the wished to have scheme. In 这给了你一个新的自由来智能集成异构系统来交谈以一种非常有效的方式彼此。


Q2:
Does this mean, that a PUB-SUB ZeroMQ pattern is performed to a best effort - UDP style?

A2:不对,还有另外一个意思。新声明的订阅者实体在某个不确定的时刻开始协商他们各自的订阅主题过滤,这样一个(分布式)过程需要一些先验的未知时间。除非在建立新的/更改的主题过滤器策略之前,没有什么可以进入 SUB-side exgress interface 来满足 .recv()-call,所以没有人真正知道,什么时候会发生,他可以吗?

在更高的层次上,还有另一个众所周知的 ZeroMQ 二分法——零保证原则——期望要么得到完整的消息,要么根本 none,这可以防止框架用户需要处理任何类型的损坏/不一致的消息负载。好的,或者 None。这是一个很好的保证。 .

越多