I'm using Rebus
with MSMQ
. I have tried Rebus with a scenario where my producer is sending messages to consumer in different machine and it works fine.
Now I need to use multiple consumers and need to distribute the load between them. I ran the sample in http://mookid.dk/oncode/archives/3621 in the producer machine. But I got the following exception from the load balancer from the first line.
I have a queue named distributor in my local machine and my worker queues exists and their names are correct
"Could not load type 'Rebus.Logging.RebusLoggerFactory' from assembly 'Rebus, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null'.":"Rebus.Logging.RebusLoggerFactory"
Could you please help me to fix this issue?
The problem is that the load balancer is old and does not work with "Rebus 2" (which is Rebus versions 0.90.0 and above).
You can easily implement a load balancer yourself with Rebus though, as you can simply create an endpoint that uses Rebus' built-in transport message forwarding capability.
This answer demonstrates how to configure transport message forwarding by calling AddTransportMessageForwarder
when configuring Rebus.
The advantage of doing it this way, is that it saves the message from going through lots of steps (e.g. deserialization, handler lookup, etc.), and therefore it is very fast.
Of course this leaves it completely up to you to implement your load balancing algorithm. It could be so simple that it would simply be started with an array of queue names to pick from, and then it would simply round-robin between them.