SendLocal on workers causes workers to send extra ready messages
When you use SendLocal on a worker, a ready message is sent back to the distributor when the message is handled. This makes the storage on the distributor grow erroneously by 1 for every time you do a SendLocal on a worker.
This is a "duplicate" of issue #571, just for SendLocal instead of SLR.
How to reproduce:
- Extend the ScaleOut sample by extending the ProcessOrderCommandHAndler to do a SendLocal(SomeCommand).
- Add a handler for SomeCommand.
- Start solution and send some orders.
Expected behaviour:
- Worker doing send local should NOT send ready messages back to the distributor when handling message it sent to itself with SendLocal and thus NOT increase the number of messages in order.handler.distributor.storage above 2.(which is the number of workers)
Observed behaviour:
- order.handler.distributor.storage increases unbounded by one every time you send an order.
Tested on 3.3.2
The fix will be to have SendLocal detect that it's running as a worker and send the message to the distributor so that sendlocal will be loadbalanced as well.
Okey, that's fair enough. Could you explain why that solution is preferred over just skipping sending a ready message when handling messages sent local? General principle of always pushing it through the distributor?
General principle of always pushing it through the distributor? That's it.
SendLocal is a logical operation, eg. "split this task up into X logical subtasks" and if your endpoint is configured to be loadbalanced physically that should include all logical operations you do in code.
Logical == devs, Physical == Admins
Sounds good, thanks!
Fixed in https://github.com/NServiceBus/NServiceBus/commit/d1dfea908a05d4abb46684c9512d1ef9a3a1c180