[zeromq-dev] Forwarder stops forwarding

Jon Dyte jon at totient.co.uk
Wed Jun 16 23:16:30 CEST 2010


Martin,

remember the discussions about the devices with Brian, Gonzalo a month 
or so back?
It was to enable uses like this that really the devices need to somehow 
expose the poll items and allow other
sockets to be part of the loop.

Jon

Matt Weinstein wrote:
> I'm using a modified ZMQ_QUEUE which uses an inproc: stream, there's a thread 
> that sends an empty packet every ms.
>
> Then in my service loop, I bind to the inproc:
>
>     zmq::socket_t ticksocket_ (ctx, ZMQ_STREAM_SINK);
>     ticksocket_.bind ("inproc://zmq_timeout");
>
> The queue poll is now against three items, which keeps me in a single thread:
>
> zmq_pollitem_t items [3];
>     items [0].socket = insocket_;
>     items [0].fd = 0;
>     items [0].events = ZMQ_POLLIN;
>     items [0].revents = 0;
>     items [1].socket = outsocket_;
>     items [1].fd = 0;
>     items [1].events = ZMQ_POLLIN;
>     items [1].revents = 0;
>     items [2].socket = ticksocket_;
>     items [2].fd = 0;
>     items [2].events = ZMQ_POLLIN;
>     items [2].revents = 0;
>
> Whenever a packet shows up on ticksocket_, I run my timeout algorithms. The tick 
> thread will eventually be phase adjusted to realtime, right now, I just use 
> usleep(1000).
>
> Really, it's a cheesy gold watch, but it works :-)
>
>
> On Jun 16, 2010, at 9:11 AM, Martin Sustrik wrote:
>
> > Matt Weinstein wrote:
> >> Simple is good :-)
> >>
> >> For a start, at least for XREQ/XREP queues, I think you can implement  
> >> this at the zmq::device ZMQ_QUEUE concentrator without requiring  
> >> socket mods.  Just tear down both sides when you fail to see a packet  
> >> in time, and use your own synthetic (uuid) identity for OOB  
> >> signaling.  Timing can be a simple third socket which just generates a  
> >> regular heartbeat so you can poll() the timing input along with the  
> >> two streams, that's what I'm using for timeouts.
> >
> > What you say is that there should be independent TCP connection only to
> > tranmit heartbeats?
> >
> > Martin
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>   




More information about the zeromq-dev mailing list