[zeromq-dev] architecture

Pieter Hintjens ph at imatix.com
Tue Jan 25 08:43:04 CET 2011


On Tue, Jan 25, 2011 at 1:12 AM, Benoit Chesneau <bchesneau at gmail.com> wrote:

> I tbink you'r right. If I want to keep ly current pattern, what I want
> is probably xreq -> rep. The thing I'm not sure about is how the xreq
> socket deals with a disconnectd rep. What happend to the messge he
> has? Does it try to send them in newly connected node?

0MQ will discard messages in such a case. You can quite easily add
your own intelligence to detect when a REP node disappears, and resend
to another node. But you do have to do this yourself.

> Other solution i see is to intoduce a broker. In above case each
> "papa" were registering in a redis db. I will write some code later
> today. (1am here). Hopefully I will release this tiny project tonight.

Registering in a DB is serious overkill: all the REP node has to do is
send a 'ready' message to the broker, when it starts up or and when it
completes a task. Second, the broker has to maintain a timeout on all
tasks, to detect blocked/died REP nodes, and third it has to maintain
a list of active REP nodes to which it can send / resend tasks.
Lastly, you need some cooperation in the worker node to do the
signalling.

It is in fact quite simple once you've worked it out, and we have an
example in ZFL (https://github.com/zeromq/zfl), in the zfl_rpc and
zfl_rpcd classes.

I'll document that fully in the new chapter 4 soon.

-Pieter

>
> Thanks for the help anyway, also I really appreciate the documentation :)
>
> - benoît
> _______________________________________________
> 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