[zeromq-dev] DEALER-ROUTER question

Goswin von Brederlow goswin-v-b at web.de
Fri Sep 26 03:10:21 CEST 2014


On Thu, Sep 25, 2014 at 02:08:41PM +0100, Riskybiz wrote:
> Dear Pieter,
> 
> As a figurehead of the zeromq project I think you should know that the

Maybe you ment spokesperson or prominent programmers instead of
figurehead? I assume you didn't ment Pieter is just a puppet.

> zguide and its examples, whilst a worthy effort, is actually a barrier to
> the progress of a learner.  As a newcomer to networking my interactions and
> attempts to learn and use zeromq over the past year has been an unyielding
> source of issues to be overcome.  Anyone else would probably have given up,
> but I recognise the benefits of the superb technology offered by zeromq.
> 
> Part of the problem is perhaps that the zguide has been written by experts,
> where seemingly minor details are glossed over.  For example in the hwserver

Now is the time for you to change that. You still see yourself as
beginer and you experience the beginner problems but seem to have
figured some of them out. Write your problems, questions and solutions
down and send patches to the guide to improve it. As "experts" it is
often increadibly hard to write examples. A lot of stuff comes just so
natural that one doesn't even think about it. It's so obvious, after
having done it that way for years, that one doesn't think t explain or
comment it. Only newbies can accurately point out where newbies have
problems understanding things.

> and hwclient code it is not demonstrated how actually to read a message
> payload from the socket and extract the received message string.  It cheats
> and prints; printf ("Received World %d\n", request_nbr);  When someone tries
> this early example the first thing they will experiment with is:  How can I
> customise the message payload and get my own message sent and received?
> They will be disappointed.  They might read on try to figure it out and be
> baffled by the multiple language bindings, apis and helper files and left
> wondering; what actually needs to be written to make zeromq work?  What is
> the core underlying zeromq commands which need to be called?  What needs to
> be installed? How do I do that? Where do I find the downloads?
> 
> I encountered a situation last year when I needed to use the common
> technique of serialization to pass custom C++ objects over zeromq sockets.
> While the zguide alludes to the possibility there was nothing to offer
> assistance in the practical implementation.  It took some considerable time,
> weeks, to sort this out into a functioning prototype.  Where a simple
> functional guide example could have saved time and questions; not just for
> me but also for any number of other users.

One of the problems here is that every language is different. The
bindings are different to better fit in with each language
environment. For example the c++ bindings (I think there are 2
competing ones) have functions to send and receive std::string. The
python3 bindings simply send/receive bytes (byte arrays) and you have
to encode/decode to convert from/to strings. Or you use
send_pyobj/recv_pyobj with nearly any kind of python object.

I think the best would be to have a mini guide for each
language/binding that explains how they make zmq fit into the
language. So now is the chance for you to start one.
 
> I find that the zguide code examples are in themselves problematic.  The
> example code is very sparsely commented.  Every line which does something
> non-trivial or zeromq specific should be explained.   I have found examples
> to be zeromq version specific, operating system specific and requiring
> modifications to work on Windows.  All of these factors just consume time in
> endeavouring to make them work or debug them with limited understanding of
> what is actually supposed to be happening.  This causes questions and
> frustrations.
> 
> CZMQ was recommended as the api to use with 'reference' C language code
> examples, I lost more time trying to compile CZMQ before realising the
> practical impossibility of this on Windows despite alluringly providing
> Visual Studio project files.  The lack of working installation instructions
> was also a barrier.  Then afterwards I discover that ROUTER sockets in
> updated zeromq versions no longer use UUID identities thus anyway
> invalidating the code example I was endeavouring to get working.  More lost
> time, more questions.   No progress.

The guide is saddly for an older version of zmq and desperately need
someone to update it. Every bit helps and if you find things that
simply no longer work then do file an issue and potentially a patch.

Pieter: Would it be possible to put all the examples of the guide into
a git project and have them included in the auto compile done for
every pull request?

> My suggestion is that if you want fewer basic questions asked in the
> community then please take time to revisit the zguide, its examples and
> necessary zeromq code resources and make it such that people can easily find
> the resources they need, confidently learn and demonstrate the examples and
> functionality for themselves; without enduring endless technical barriers
> and frustrations.
> 
> I hope you will view my feedback as constructive.
> 
> All that said; which part of the guide should I read to solve my
> DEALER-ROUTER issue, can I be confident that any associated zguide example
> will actually work and help me to further understand how to solve my own
> zeromq issues in the future?
> 
> 
> Riskybiz.
> 
> 
> Message: 29
> Date: Thu, 25 Sep 2014 11:29:01 +0200
> From: Pieter Hintjens <ph at imatix.com>
> Subject: Re: [zeromq-dev] DEALER-ROUTER question.
> To: ZeroMQ development list <zeromq-dev at lists.zeromq.org>
> Message-ID:
> 	<CADL5_sjhfSqq_YDJq59pindtY3t15dUpiJVO3wr=qEHn+tYeJA at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> Please read the Guide and work through the examples, it has lots of
> explanation and examples of how to do this kind of thing.
> 
> On Thu, Sep 25, 2014 at 10:36 AM, Riskybiz <riskybizlive at live.com> wrote:
> > A quick question for the zeromq experts if I may?
> >
> >
> >
> > Given a DEALER to ROUTER zeromq connection which is able to operate
> > asynchronously; what is the best way to coordinate inbound and outbound
> > message handling such that the DEALER socket is not blocked and an
> > application is able to react and send at a given moment but also to
> promptly
> > receive?

To answere your initial question:

Simple case: zmp_poll
Complex case: credit based workflow

Both of these occur in the guide.

> > Thanks,
> > Riskybiz.

MfG
	Goswin



More information about the zeromq-dev mailing list