Patriq distributes the messages which arrive in queue "base" to queues "default" and "other". The distribution is determined by the Label property of each message. The python scripts evaluate the Label property of each message and "decide" by the said property where each message should end up. Since it's a dynamic script, you can rewrite the distribution rule (or set up various rules of your own) without the need to recompile the entire project.

The current implementation states that all participating queues should be private and transactional (in order to perform a rollback in the case of failure).

The sample rule implemented in this project expects to find a Json formatted object in the Label property of the message. This Json object should have a "Machine" property and, according to it, the message is sent to either "default" queue or "other" queue. If there is not object in the Label of the message, or the format doesn't correspond to what we expect, the message will be sent to "default".

There are 2 python scripts in the application - "" and "". The division exists in order to separate the distribution logic from the data on which the distribution logic hinges (thus, making it easier to unit test).

Last edited Jan 2, 2012 at 6:50 AM by KleinRon, version 2


No comments yet.