private static void InitClusterNode(ClusterNode node)
{
node.RootActors = new List<IActorRef>();
foreach (var role in node.Roles)
{
IActorRef rootActor;
switch (role)
{
case "producer":
rootActor = node.Context.System.ActorOf(Props.Create(() => new EchoProducerActor(node.Context)));
break;
case "consumer":
rootActor = node.Context.System.ActorOf(Props.Create(() => new EchoConsumerActor(node.Context)));
break;
default:
throw new InvalidOperationException("Invalid role: " + role);
}
node.RootActors.Add(rootActor);
}
}