[zeromq-dev] Multipart messages and synchronization on jeromq router/dealer sockets

Kuldeep Marathe marathe.kuldeep at gmail.com
Wed Mar 11 04:56:28 CET 2015


Hi All,

I am experimenting with a  pub/sub + last value caching system using
jeromq. I am facing few issues with multipart messages and synchronization
on the router socket.

Current model:

- A publisher/broker uses a router socket for listening to incoming
subscribers and their queries. Based on the query, router publishes the
topics and messages to specific clients using multipart messages.

-  A client/subscriber uses a dealer socket to connect to different
publishers. Sends the interested topics and other filters using multipart
messages.


Current issues:
- *Handling disconnects* When a client disconnects, router can easily
detect it during send() call. But with SNDMORE call, it blocks
indefinitely.I can get around it by using a receive timeout, but I have to
check the return boolean value for every SNDMMORE call. I am not sure in
what cases this would be false apart from timing out. Also, it would be
ideal if the final send() call returned the appropriate status without
blocking on the SNDMORE calls.

-* Synchronization on router . *The router is being handled by two
different threads.  One thread publishes the messages to clients while the
other polls for new connections with NOWAIT flag. Is there a way to avoid
synchronization in such cases. Are there any tips/patterns to avoid
processing router sockets in two different threads.


Any guidance or thoughts on this would be really helpful. Thanks in advance.



Thanks,
Kuldeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150310/2ecc876c/attachment.htm>


More information about the zeromq-dev mailing list