[zeromq-dev] Lazy subscriber, only receive last message

Dorvin dorvin at tlen.pl
Wed Oct 15 13:24:37 CEST 2014


W dniu 2014-10-15 12:20, Mathieu Westphal pisze:

> server will send 10 message when the client as the time only to receive and use one.
> The thing is, the client doesn't care at all about losing message, but it cares about getting the last sent message.
If you send only single part messages then you might use ZMQ_CONFLATE.
>
> I've tried to use high water mark for that, but it does not seem to work at all.
> I've also seen this post from 2011, http://lists.zeromq.org/pipermail/zeromq-dev/2011-May/011081.html,
> wich propose the use of dedicated reader thread on the client, but the downside of this solution is the message are indeed transferred on the network while they could have been dropped !
This is no longer necessary as pub/sub filtering is currently performed 
on publisher's side.
>
> My solution is to connect/deconnect the client each time i want to receive a message, but the connect method take some milliseconds, so it is not good also.
>
This is lengthy operation. If CONFLATE is not an option you may consider 
doing subscribe/unsubscribe which should be significantly faster. Other 
option would include changing from pub/sub to f.e. req/rep. This way 
requestor (previously subscriber) could ask for last message.


Cheers,
Jarek




More information about the zeromq-dev mailing list