Akka.Net provides a number of usefull routing strategies out of the box (we currently use smallest mailbox and consistent hashing), but what if want to implement custom router with strategy based on let's call it Worker Node Load Index which is will be calculated separetly on each node based on current resource consumption.
I could not find docs or examples regarding this topic, so any info is higly appreciated.
Thanks
You can create your own routing strategy by deriving from the base RoutingLogic
class: https://github.com/akkadotnet/akka.net/blob/614f1f0e824384f065e7b72e827c1ff937eafca5/src/core/Akka/Routing/Router.cs#L166
Overall your class might look a bit like:
public class CustomRouter : RoutingLogic
{
public override Routee Select(object message, Routee[] routees)
{
return routees.OrderBy(WorkerNodeLoadIndex).First();
}
private double WorkerNodeLoadIndex(Routee arg)
{
return 0.0; // put your real calculation here
}
}