private void HandleTaskMessage(AsyncTaskMessage message) { var originalSender = Sender; ColorConsole.WriteOrange($"The Sender of AsyncTaskMessage is '{originalSender}'"); DelayAndReturnZero().PipeTo(Self, originalSender); }
public TestControllerActor() { Receive <CreateTestActor>(m => { ColorConsole.WriteOrange($"The Sender of CreateTestActor is '{Sender}'"); var child = Context.ActorOf(Props.Create(() => new TestActor(m.ActorName)), m.ActorName); Children.Add(m.ActorName, child); }); Receive <AsyncResponseMessage>(m => ColorConsole.WriteGreen($"Async result from {Sender}")); }
public TestActor(string actorName) { this.actorName = actorName; Receive <AsyncTaskMessage>(m => HandleTaskMessage(m)); Receive <int>(m => { ColorConsole.WriteOrange($"The Recipient of AsyncTaskResponse is '{Sender}'"); Sender.Tell(new AsyncResponseMessage()); }); //ReceiveAsync<int>(async m => await DelayAndReturnZero()); ColorConsole.WriteViolet($"TestActor '{actorName}' created"); }