Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var manager = system.ActorOf<Manager>(); try { await manager.GracefulStop(TimeSpan.FromMilliseconds(5), "shutdown"); // the actor has been stopped } catch (TaskCanceledException) { // the actor wasn't stopped within 5 seconds } ... public class Manager : UntypedActor { private IActorRef worker = Context.Watch(Context.ActorOf<Cruncher>("worker")); protected override void OnReceive(object message) { switch (message) { case "job": worker.Tell("crunch"); break; case Shutdown s: worker.Tell(PoisonPill.Instance, Self); //하위 worker의 작동을 중지시킵니다. Context.Become(ShuttingDown); break; } } private void ShuttingDown(object message) { switch (message) { case "job": //어떤 잡을 시키려고 할시,셧다운중임을 알립니다. Sender.Tell("service unavailable, shutting down", Self); break; case Terminated t: Context.Stop(Self); break; } } } |
액터접근 주소체계
...
잠시
실습없이, Actor를 접근하는 주소체계에대해 설명 드리겠습니다. ActorPath는 ActorPath는 총 4가지로 구분이 되며 http의 되며 http의 RestAPI의 주소체계와 거의 흡사하다고 볼수 있습니다.
...