private void Behavior() { var on_lost = Handle <LostLetter>(); on_lost += letter => { if (!System.Config.LogLostLetters) { return; } ActorLog.Info( $"Message from \"{letter.Sender.Path.Path}\" containing " + $"{letter.Data.GetType().Name} did not reach target " + $"at \"{letter.Receiver.Path}\". " + "Data: {0}", new object[] { letter.Data } ); }; var on_any = AnyHandler(); on_any += msg => { ActorLog.Warning( $"{nameof(LostLetters)} got a message that was not of {nameof(LostLetter)}!" ); }; }
private void Behavior1() { var respond = Handler <(string Command, string Message)> .Create(this); respond += msg => StrEq(msg.Command, "LOG"); respond += msg => { ActorLog.Info(msg.Message); }; }
internal override void InformParentOfError(Exception e) { if (Children.Count == 0) { ActorLog.Warning("Tried to inform root supervisor of an error when it has no children to error"); return; } var child_ref = Children[0]; var fault = new Fault(System, Self.Path, child_ref, e); Self.Tell(fault, child_ref); }
private void Behavior() { var on_fault = Handle <Fault>(); on_fault += fault => { ActorLog.Fatal( fault.Exception, $"System supervisor encountered an unhandled exception. " + $"Actor system will now be shut down." ); fault.Destroy(); System.Shutdown(); }; }