[zeromq-dev] If not Majordomo for asynchronous workers, then what?
Pieter Hintjens
ph at imatix.com
Fri Jul 27 09:07:33 CEST 2012
Hi Ivan,
Majordomo is based on a 1-to-1 request-reply model for workers, yes.
You should be able to quite easily modify MDP to allow multiple
replies, perhaps by adding a "there's more coming" indicator to
replies that the broker uses to route several replies back to the same
client.
Modifying MDP and the implementations will be simpler than writing
your own from scratch.
You can also use other architectures; MDP is specifically aimed at
allowing multiple redundant workers per service type. If you have a
single well-known gateway per exchange you can just connect each
client to each exchange gateway directly and work fully
asynchronously.
-Pieter
On Thu, Jul 26, 2012 at 10:29 PM, Ivan Figueredo <ivan at blackpx.com> wrote:
> I am writing a distributed trading manager. There are many different
> liquidity providers, and the client would like to route to a given exchange.
> With this in mind, I thought that using the Majordomo pattern with a broker
> in between clients and workers asking a particular [named] worker to do its
> work. However at least as I understand it, Majordomo won't work in this
> scenario.
>
> Let's take the FIX protocol. Since FIX is asynchronous, I believe I can't
> use the Majordomo. You may send an order to a FIX engine, and that one order
> may send back many different messages. For example, that one order may see
> the following responses: Insert, Pending, New, Partial Fill, then finally
> Fill.
>
> In the Majordomo pattern, a section of code in the worker looks like this
>
> mdwrk session ("tcp://localhost:5555", sourceStr.c_str(), verbose);
>
> zmsg *reply = 0;
> while (1) {
> zmsg *request = session.recv (reply);
> if (request == 0) {
> break; // Worker was interrupted
> }
>
> //reply = request; // Echo is complex... :-)
> reply = new zmsg(sourceStr.c_str());
> }
>
>
> This assumes one request, and one reply. Since my application is not
> strictly a single request, that gets a single response as in the code above,
> do I have to drop Majordomo ?
>
>
> Thanks!
>
>
> _______________________________________________
> 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