We’ve seen before how the NServiceBus distributor can delegate the messages to its workers. But here’s couple interesting questions:
- Can the worker reply back to the client?
- Doesn’t the distributor become a bottleneck if it has to deliver the messages from the client to the workers and back?
And here are the answers: Yes. Not so much.
1. How to reply from a worker to the client when NServiceBus distributor is in use?
You can reply to the client using the basic Bus.Return and Bus.Reply-messages. It doesn’t matter that the distributor is used because NServiceBus will route the reply to the correct place.
2. Why doesn’t the distributor become a bottleneck if it’s delivering messages back and forth?
Even though the distributor is required to deliver the message from the client to a worker, it is not usedwhen a worker replies to the client. Instead, the worker sends the reply directly to the client’s input queue.
We can use this information to finish our NServiceBus distributor’s architecture sketch from “Using NServiceBus distributor”.
This means that your distributor can be down and still the worker can deliver the reply to the calling client.