[zeromq-dev] PUB socket dropping old messages instead of new ones

Auer, Jens jens.auer at cgi.com
Mon Dec 5 13:47:59 CET 2016


I am using a XPUB socket to distribute data between three sites in several channels. For our application, it would be better if the socket would drop old messages when it reaches the HWM. I searched the mailing list and found some old questions asking about this, and an answer that it has been requested but never implemented, although it should be fairly easy. So I had a quick look at the source code, but I don't think that it is as easy as expected.

The internal pipe is implemented with the assumption that each end is not modified concurrently, i.e. there are never two concurrent writes are reads. Concurrent read and write is of course expected. From what I see, this makes it hard to drop the oldest message in the queue because the queue has to be modified from the writer thread. Does anybody have an idea on how to do this? I think it could be possible to send to a command to the writer thread to drop a message, but that does not sound very efficient. If somebody could point me to the right direction I can pick up from there.


Jens Auer | CGI | Software-Engineer
CGI (Germany) GmbH & Co. KG
Rheinstraße 95 | 64295 Darmstadt | Germany
T: +49 6151 36860 154
jens.auer at cgi.com<mailto:jens.auer at cgi.com>
Unsere Pflichtangaben gemäß § 35a GmbHG / §§ 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben<http://de.cgi.com/pflichtangaben>.

CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161205/432cdb46/attachment.htm>

More information about the zeromq-dev mailing list