[zeromq-dev] CZMQ guaranteed delivery

Johnny Depp sdusa at hotmail.com
Thu May 14 20:03:22 CEST 2020


Hi,
Here is my environment: RHEL/CENTOS 7, CZMQ version 4.2.1, ZMQ version 5.2.3, GCC version 4.8.5.

I have a classic (as in examples) setting of a client-server:

client:
for (i= 0; i< 1000; i++_ {
 zstr_send(client, json_string);
 zsys_debug("Sent: %d %s", strlen(json_string), json_string);
}

server:
while(!zsys_interrupted) {
        zsock_t *which = (zsock_t *) zpoller_wait (poller, 500);

       if (which != NULL) {
            char *message = zstr_recv (which);
            zsys_debug("Message: %s", message);
            handle_json(message);
            zstr_free (&message);
        }
    }

If the client sends 1000 messages, the server handles them with aplomb and all is well. However, if the client sends 10000 messages, about 1000 are lost. The client pauses from time to time while sending, but the server loses messages.

I undrstand that while handling json messages, there is a delay. But regardless of that, even if this would be a simple send and receive, how can I guarantee delivery? Is there another mechanism or pattern that I should employ? Adding more server reading threads would help with this? Is there a way of buffering?

Thank you,

Johnny


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200514/290c1965/attachment.htm>


More information about the zeromq-dev mailing list