Search code examples
node.jszeromqpublish-subscribe

zmq subscriber fails to receive message when subscriber is restarted


I have PUB/SUB program using zmq broker ( node.js ).

Subscriber doesn't receive messages while subscriber is restarted and publisher is still publishing the messages. But PUB/SUB is working fine when both publisher and subscriber services are started naturally. Reason behind this is unknown.

What could possibly be wrong?


Solution

  • While it is impossible to cover exactly a case of an undisclosed MCVE-design of using a PUB-archetype, on Publisher side, and an unspecified number of SUB-archetype nodes on the Subscribers' sides, there is one important fact.

    The Design

    Yes, the Design. Having read the API, user will be sure that

    • ZeroMQ does not guarrantee a message delivery

    • ZeroMQ PUB-lisher does not wait and publishes a message for all connected SUB-scribers, not waiting for late-joiners, nor providing any queue/persistence for not connected SUB-scribers and discards all messages that were requested to PUB-lish during times there are no SUB-s connected.


    enter image description here