// Create ActorSystem
var actorSystem = akkaService.CreateActorSystem();
// Create RoundRobin Router
var roundrobin = actorSystem.ActorOf(Props.Create<BasicActor>().WithRouter(new RoundRobinPool(0)));
// Create Throttle And connect Router
int tps = 1;
var throttle = actorSystem.ActorOf(Props.Create(() => new ThrottleActor(tps)));
throttle.Tell(new SetTarget(roundrobin));
// Create Worker and Add Routee
var workActor = actorSystem.ActorOf(Props.Create<BasicActor>(), NodeName);
var routee = Routee.FromActorRef(workActor);
roundrobin.Tell(new AddRoutee(routee));
// Change TPS at Runtime
throttle.Tell(new ChangeTPS() { processCouuntPerSec = 3 });
// Say Hello
throttle.Tell(new TodoQueue()
{
Todo = new Todo()
{
Id = i.ToString(),
Title = "Hello"
}
});
round-robin with Throttle router actor
속도조절이 포함되어 분배처리합니다.
Akka System
Throttle
RouterActor