[nanomsg] Pub/Sub behavior

  • From: Charles McParland <cpmcparland@xxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Fri, 13 Nov 2015 11:08:32 -0800

After reading through docs and going through several installs, I've
finally run into a project that's a good fit for nanomsg. I have a
loosely coupled collection of java threads running on a Debian
system that are monitoring and analyzing real-time data flowing in through
a single tcp stream. These threads - and perhaps, later, separate
processes - will come and go over time. So I would like to use
pub/sub to distribute data messages to them using a sort of "best efforts"
policy.

I have pub sub working (using jnanomsg and JNA) and seems to
work well using tcp. But I can't quite figure out what
happens when a subscriber gets too far behind. Using tcp,
I can publish hundreds of messages and
the subscriber - which I've manually slowed down - keeps handing
me the earliest messages in order. So, are these messages getting
cached in the subscriber nanomsg stack ? Can I reach down and
flush old messages and force the subscriber to get "current"?

I've read some discussions of this pattern in the Zeromq docs.
While the use cases seem to be laid out, I don't see a way
to drag the solution directly over to nanomsg. I guess I can always
close the socket and re-connect. But don't know how large a
performance hit that turns into. Just seems like there's a place
for a policy handle in the pub/sub pattern.

Any info or pointers into the code so that I can dig deeper would
be appreciated.

Thanks,
Chuck McP

Other related posts: