The best recommendation is to use Akka.Cluster. Here's a well-documented example: https://github.com/petabridge/akkadotnet-code-samples/tree/master/Cluster.WebCrawler
Edit - removed the offer to use the dynamic port. It is much better to use static ones, so node reloading can be done correctly.
Ask each plugin configuration to use a plugin- akka.remote.helios.tcp.port = 1231 port ( akka.remote.helios.tcp.port = 1231 ), and then define a cluster router that interacts with actor systems that perform specific roles.
/api/broadcaster { router = broadcast-group routees.paths = ["user/api"] cluster { enabled = on max-nr-of-instances-per-node = 1 allow-local-routees = on use-role = crawler } }
This router, deployed on the user/api/broadcaster path on some node, can communicate (via the Broadcast routing strategy) with any player deployed on the user/api path on any node in the crawler role without having to look for IP addresses, ports or any of them.
You configure node clustering information through the following section in the Akka.NET configuration:
cluster { #manually populate other seed nodes here, ie "akka.tcp:// lighthouse@127.0.0.1 :4053" seed-nodes = ["akka.tcp:// webcrawler@127.0.0.1 :4053"] roles = [crawler] }
Seed Nodes - Must be a well-known, statically defined port and IP address. Read the article to explain why this is important.
Roles are comma-delimited strings that determine what the capabilities of this particular node are. They are more like tags. You can use them in cluster routers (for example, the one I showed earlier) to formulate what types of nodes you want to communicate with.
source share