[zeromq-dev] Forwarder stops forwarding

Matt Weinstein matt_weinstein at yahoo.com
Wed Jun 16 15:22:13 CEST 2010


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
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100616/26dc27dd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: picture_of_cheesy_gold_watch_from_Speed.png
Type: image/png
Size: 144522 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100616/26dc27dd/attachment.png>


More information about the zeromq-dev mailing list