I have a system with one MSMQ sender (generates about 10k messages/sec) and one MSMQ receiver (2k messages/sec). Generating and sending messages is fast, reading and processing is slow. Hence I want to put a load balancer and use a few receivers. At the moment messages are XML-formatted, once I sort out load balancing I plan to move to binary formatter.
Problem: message with a particular label (or if possible inner XML tag value) shall go to exactly the same receiver all the time. Situation when server is down is out of scope for this question (bonus if you know how to handle this).
I use HAProxy for other round robin MSMQ load balancing, and that works fine in TCP mode. I wondered if I can reuse it for this situation.
Question: how to configure HAProxy to load balance MSMQ messages based either on the label or XML-formatted tag value inside a message. Messages with the same label must go to the constant receiver. Are there any other alternatives?
Sample:
message [Label="server1"] [XML BODY ...] => LB => server1
message [Label="server2"] [XML BODY ...] => LB => server2
or similar to what RabbitMQ does for "Direct exchange"
Image source: pubs.vmware.com