Search code examples
c++proxyzeromqpublish-subscribe

Can I use an XSUB/XPUB zeromq pattern and add a timestamp/sequence number to each message


I am using zeromq to create a generic dynamic graph setup. I already have a XPUB/XSUB setup but am wondering if there is a zmq way of adding a sequence number/timestamp to each message going through generated by the proxy in order to have a uniquely sequenced “tape” of events?


Solution

  • Q : "... but am wondering if there is a zmq way of adding ... to each message ...?"

    No, there is not. ZeroMQ way would be to have this done with Zero-Copy and (almost) Zero-Latency.

    Such way does not exist for your wished use-case.


    Solution ? Doable :

    Create a transforming-node, where each message will get transformed accordingly ( SEQ-number added and TimeSTAMP datum { pre | ap }-pended ). Such step requires one to implement such a node and handle all such steps altogether with any exceptions per incident.

    The ready-made API-documented zmq_proxy() simply does not and cannot and should not cover these specific requirements, as it was designed for other purposes ( and uses a Zero-Copy for the most efficient pass-through + ev. efficient MITM-logger mode(s) of service ).