[zeromq-dev] Cannot setup high water mark for PUB/SUB
DEBROUX, LIONEL
lionel.debroux at atos.net
Thu Jul 14 09:33:21 CEST 2016
Hello,
> I cannot seem to be able to set up the high water mark for PUB/SUB.
>
> My subscriber is expected sometimes to be somewhat slower than
> publisher hence I want the publisher to drop the messages when
> subscriber is slow. I want to set up the high water mark to, say,
> 2 messages, so when the subscriber is behind for two messages then
> the publisher will start dropping them.
>
> Can you take a look at my code. The publisher sends messages once
> every 200ms, the subscriber reads messages once every second, the
> high water mark is set to 2. Hence, I expect subscriber to receive
> approximately every fifth message. However, my subscriber diligently
> reads all messages consequently and the publisher gets far ahead.
>
> http://pastebin.com/2fv525ke
Try calling zmq_setsockopt(socket, ZMQ_SNDHWM / ZMQ_RCVHWM, ...) before
calling zmq_bind() / zmq_connect().
AFAICS, I'm doing it that way in my own code which uses HWM for PUB and
SUB, and I know that a number of ZMQ socket options have an effect only
when set before bind / connect.
Regards,
Lionel.
Ce message et toutes les pièces jointes (ci-après le "message") sont établis à l’intention exclusive des destinataires désignés. Il contient des informations confidentielles et pouvant être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de détruire le message. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse de l’émetteur. L'internet ne garantissant pas l'intégrité de ce message lors de son acheminement, Atos (et ses filiales) décline(nt) toute responsabilité au titre de son contenu. Bien que ce message ait fait l’objet d’un traitement anti-virus lors de son envoi, l’émetteur ne peut garantir l’absence totale de logiciels malveillants dans son contenu et ne pourrait être tenu pour responsable des dommages engendrés par la transmission de l’un d’eux.
This message and any attachments (the "message") are intended solely for the addressee(s). It contains confidential information, that may be privileged. If you receive this message in error, please notify the sender immediately and delete the message. Any use of the message in violation of its purpose, any dissemination or disclosure, either wholly or partially is strictly prohibited, unless it has been explicitly authorized by the sender. As its integrity cannot be secured on the internet, Atos and its subsidiaries decline any liability for the content of this message. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
More information about the zeromq-dev
mailing list