[zeromq-dev] Pattern for clean shutdown of a proxy loop

Lindley French lindleyf at gmail.com
Wed Mar 12 00:02:49 CET 2014


Long term, I would think it best to extend one of the C++ wrappers,
probably zmqpp, with czmq functionality. (This could even be a wrapper to
the wrapper.)

Short term, it isn't that hard to replicate the design by creating your own
inproc socket in zmqpp or whatever that is used together with a poller.


On Tue, Mar 11, 2014 at 3:58 PM, Cosmo Harrigan <
cosmo.harrigan at singularityu.org> wrote:

> Thanks for the reply. I took a look, and my understanding is that the CZMQ
> zproxy class waits for messages from both a backend and a pipe (which is a
> PAIR socket to expose the API) and updates a local variable 'stopped' which
> ends the loop when the pipe receives the 'STOP' command.
>
> And it refers to that as a 'steerable proxy'.
>
> Then, I found that there is a class in libzmq called zmq_proxy_steerable (
> http://api.zeromq.org/4-1:zmq-proxy-steerable), which seems to offer
> exactly what I was asking about.
>
> Why isn't CZMQ zproxy using zmq_proxy_steerable?
>
> For C++ programming, cppzmq doesn't wrap either of those classes. Niether
> does zmqpp.
>
> So, I'm wondering, what pattern do other people who are using ZeroMQ in
> C++ currently follow in this case to control their proxy loops? I suppose
> one solution is the one mentioned in the other thread, namely, wrapping
> CZMQ in your C++ application. Any suggestions?
>
> Thanks,
> Cosmo
>
>
>
>
>
> On Tue, Mar 11, 2014 at 2:02 PM, Pieter Hintjens <ph at imatix.com> wrote:
>
>> You can look at the CZMQ zproxy class to see one way to do this.
>>
>> On Tue, Mar 11, 2014 at 9:35 PM, Cosmo Harrigan
>> <cosmo.harrigan at singularityu.org> wrote:
>> > Hi,
>> >
>> > What is the best practice when you are creating a loop that functions
>> like
>> > the zmq_proxy device, to bind a PULL socket that is fed by a backend
>> > ventilator with a frontend PUB socket, in order to properly handle a
>> clean
>> > shutdown?
>> >
>> > Most of the examples on the zguide just show "while (1)" with a loop
>> that
>> > never terminates. What's the suggested way of signaling to the loop
>> which is
>> > running in its own thread that it is time to shut down?
>> >
>> > Thanks,
>> > Cosmo
>> >
>> >
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > 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
>>
>
>
> _______________________________________________
> 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/20140311/76a590bd/attachment.htm>


More information about the zeromq-dev mailing list