NetCoreLabs

round-robin with Throttle router actor

속도조절이 포함되어 분배처리합니다.

Akka System
Throttle
RouterActor
WorkActorA1
WorkActorA2
WorkActorA3
WorkActorA4
WorkActorA5
WorkActorA6
WorkActorA7
WorkActorA8
WorkActorA9
WorkActorA10
WorkActorA11
WorkActorA12
SampleCode
// 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"                        
    }
});
An unhandled exception has occurred. See browser dev tools for details. Reload 🗙