Page History
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
public class StartStopActor1 : ReceiveActor { private ILoggingAdapter log = Context.GetLogger(); public StartStopActor1() { Receive<string>(message => { if (message == "stop") { Context.Stop(Self); } }); } protected override void PreStart() { log.Info("first started"); Context.ActorOf<StartStopActor2>("second"); } protected override void PostStop() { log.Info("first stopped"); } } public class StartStopActor2 : ReceiveActor { private ILoggingAdapter log = Context.GetLogger(); public StartStopActor2() { Receive<string>(message => { }); } protected override void PreStart() { log.Info("second started"); } protected override void PostStop() { log.Info("second stopped"); } } IActorRef myActor = actorSystem.ActorOf<StartStopActor1 >("myactor"); myActor.Tell("stop"); //OutPut //first started //second started //second stopped //first stopped |
...
Supervisor을 통한 장애처리
Child 액터가 장애발생시, 디양한 복구전략( 3초간 30초동안시도)을 통해 Child액터의 복구가 가능하다.
...