Reputation: 3193
Can I publisher service receive data from an external source and send them to the subscribers?
In the wuserver.cpp
example, the data are generated from the same script.
Can I write a ZMQ_PUBLISHER
entity, which receives data from external data source / application ... ?
In this affirmation:
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.
Does this mean, that a PUB-SUB
ZeroMQ pattern is performed to a best effort - UDP style?
Upvotes: 1
Views: 103
Reputation: 1
Q1:
Can I write aZMQ_PUBLISHER
entity, which receives data from external data source/application?
A1: Oh sure, this is why ZeroMQ is so helping us in designing smart distributed-systems. 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 distributed-systems this gives you a new freedom to smart integrate heterogeneous systems to talk to each other in a very efficient way.
Q2:
Does this mean, that aPUB-SUB
ZeroMQ pattern is performed to a best effort - UDP style?
A2: No, it has another meaning. The newly declared subscriber entities at some uncertain moment start to negotiate their respective subscription-topic filtering and such a ( distributed ) process takes some a-priori unknown time. Unless until the new / changed topic-filter policy was established, there is nothing to go into the SUB
-side exgress interface to meet a .recv()
-call, so no one can indeed tell, when that will get happened, can he?
On a higher level, there is another well known dichotomy of ZeroMQ -- Zero-Warranty Principle -- expect to either get delivered a complete message or none at all, which prevents the framework users from a need to handle any kind of damaged / inconsistent message-payloads. Either OK, or None
. That's a great warranty. The more for distributed-systems.
Upvotes: 1