protected override void PreRestart(System.Exception reason, object message)
 {
     ActorMonitoringExtension.Monitors(Context.System).IncrementActorRestart(Context);
     Context.System.EventStream.Unsubscribe(Self, typeof(Error));
     Context.System.EventStream.Unsubscribe(Self, typeof(Warning));
     Context.System.EventStream.Unsubscribe(Self, typeof(Debug));
     Context.System.EventStream.Unsubscribe(Self, typeof(Info));
     Context.System.EventStream.Unsubscribe(Self, typeof(DeadLetter));
     Context.System.EventStream.Unsubscribe(Self, typeof(UnhandledMessage));
 }
 protected override void PreStart()
 {
     ActorMonitoringExtension.Monitors(Context.System).IncrementActorCreated(Context);
     Context.System.EventStream.Subscribe(Self, typeof(Error));
     Context.System.EventStream.Subscribe(Self, typeof(Warning));
     Context.System.EventStream.Subscribe(Self, typeof(Debug));
     Context.System.EventStream.Subscribe(Self, typeof(Info));
     Context.System.EventStream.Subscribe(Self, typeof(DeadLetter));
     Context.System.EventStream.Subscribe(Self, typeof(UnhandledMessage));
 }
        public void Handle(LogEvent message)
        {
            var monitor = ActorMonitoringExtension.Monitors(Context.System);

            message.Match()
            .With <Debug>(d => monitor.IncrementDebugsLogged())
            .With <Error>(e => monitor.IncrementErrorsLogged())
            .With <Warning>(w => monitor.IncrementWarningsLogged())
            .With <Info>(i => monitor.IncrementInfosLogged())
            .Default(d => monitor.IncrementUnhandledMessage());
        }
 public void Handle(UnhandledMessage message)
 {
     ActorMonitoringExtension.Monitors(Context.System).IncrementUnhandledMessage();
 }
 public void Handle(DeadLetter message)
 {
     ActorMonitoringExtension.Monitors(Context.System).IncrementDeadLetters();
 }
 protected override void PostStop()
 {
     ActorMonitoringExtension.Monitors(Context.System).IncrementActorStopped(Context);
 }
 /// <summary>
 /// Fetches the monitors for the provided <see cref="IActorContext"/>
 /// </summary>
 private static ActorMonitor GetMonitor(IActorContext context)
 {
     return(ActorMonitoringExtension.Monitors(context.System));
 }