Another reliable way to make PULL-PUSH sync in ZeroMQ
If you are using PUSH sockets, you will find that the first PULL socket to connect will capture an unfair proportion of messages. The exact rotation of messages occurs only when all PULL cells are successfully connected, which can take several milliseconds. Alternatively to PUSH / PULL, for lower baud rates, use ROUTER / DEALER and load balancing pattern.
So, one way to do PUSH / PULL synchronization is to use a load balancing pattern.
In this particular case, below I wonder if there is another way to do sync:
I could set the PULL endpoint at the worker to block until the connection is successfully configured, and then send a custom message through the worker's PULL endpoint to "sink". After sink receives the special workwork messages, sink sends a REQ-REP message to the fan to inform that all workers are ready. The "fan" begins to distribute jobs to workers. Reliability?
Image from here
source to share
Yes, as long as he Sink
knows how long he Workers
waits before letting him Ventilator
know he's OK to start sending messages. There the question arises as to whether ad hoc messages go through Workers
if they run before connecting Sink
, but you can work it out if they keep sending their ad hoc message until they start receiving data from Ventilator
. If you do this, of Sink
course, it will just ignore any duplicates it receives.
Of course, this is not exactly the same as having Workers
a live working connection with Ventilator
, but this may by itself send the special do-nothing messages it receives Workers
. When they receive one of them, when can they start sending a special message to Sink
.
source to share