[zeromq-dev] programmable message routing
Martin Sustrik
sustrik at fastmq.com
Thu Jan 22 10:53:30 CET 2009
Hi Ferenc,
> Let's have three node. Node1 defines E1 with global scope while node2
> and node3 create local Q queues and all of them bind the local Q queue
> to E1 exchange. If the node1 sends message to E1 all of the nodes will
> receive these messages.
>
> I would like to implement the following message routing:
> First E1 sends message to the first node and if there was an 'error' (or
> any specified event happend) then it sends to the next node.
>
> If I understand correctly the demux class includes message routing
> currently. However when I create exchange I could not define different
> demux.
>
> I read in the list archive that the implementation of the complex
> routing scenatios like topic-based routing is under the way, however I
> would be interested in the solution which gives more control to
> developer in the routing. Can you tell me what is the plan related to
> this topic? Is there any place to the contribution?
I am not sure what exactly does your scenario look like, but I suspect
you may want load-balancing (i.e. fair distribution of messages between
several queues). If that's the case have a look at 0.3.3 branch in
Subversion. There, you cas specify a 'load-balance' flag when creating
the exchange that will cause exchange to distribute messages between the
queues in round-robin manner.
As for more complex routing, yes, it's on our roadmap. If you want to
contribute here we'll be happy to collaborate with you.
Basically, the idea of generalised routing is that there'll be another
layer on top of existing 0MQ implementation that will define special
section of the message (a.k.a. message header) containing data that can
be used by routing algorithm. The layer should expose an API that would
allow 0MQ users to specify the message header (this can be a simple
integer, string or even a table of name-value pairs).
Once you have that you are able to write an exchange implementation that
will check the message header and dispatch the message to appropriate
destinations.
For algorithms we want to use for message matching have a look here:
http://www.zeromq.org/whitepapers:message-matching
Of course, even different algorithms may be used given that they are
extra-fast :)
Regards and let us know your thoughts.
Martin
More information about the zeromq-dev
mailing list