Hello all:

I have a question that I’m hoping someone with more experience than I can help 
answer, which is whether the order of connections and/or handshakes can be 
relied on in certain cases.  

I understand that generally connect and handshake happen asynchronously, and 
that the only way to be certain is to use zmq_socket_monitor and capture the 
individual events.

However, I have a specific use case in mind:

- process A is connecting to a zmq_proxy  at a well-known address (essentially 
the "Weather Update" proxy from the Guide):
 - it first connects a ZMQ_SUB socket (to the proxy’s ZMQ_XPUB socket)
 - it next connects a ZMQ_PUB socket (to the proxy’s ZMQ_XSUB socket)

It turns out that it would be very handy to be able to rely on the SUB socket 
completing its handshake BEFORE the PUB socket's handshake completes. 

If that is the case, then I believe that process A can rely on the SUB socket 
getting any message it publishes on the PUB socket.  More importantly, it can 
rely on the fact that no other processes connected to the proxy will see a 
message from process A's PUB socket that process A's SUB socket does not see 
itself.

So I guess the question boils down to: is there any possibility that the PUB 
socket's handshake will complete before the SUB socket's?

Given that the connect calls are both being done from the same process to the 
same (other) process, it seems that this might be a reliable pattern, but I 
don’t know the code well enough to be certain.

Or am I stuck with having to use  zmq_socket_monitor to capture the events and 
provide synchronization around them?  (Which I would prefer to avoid if 
possible -- that can be messy and error-prone).

Any tips, suggestions much appreciated!

Regards,

Bill Torpey
_______________________________________________
zeromq-dev mailing list
[email protected]
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to