Akka.Event.LoggerMailbox.CleanUp C# (CSharp) Method

CleanUp() public method

public CleanUp ( ) : void
return void
        public override void CleanUp()
        {
            if (HasMessages)
            {
                Envelope envelope;

                // Drain all remaining messages to the StandardOutLogger.
                // CleanUp is called after switching out the mailbox, which is why
                // this kind of look works without a limit.
                while (TryDequeue(out envelope))
                {
                    // Logging.StandardOutLogger is a MinimalActorRef, i.e. not a "real" actor
                    Logging.StandardOutLogger.Tell(envelope.Message, envelope.Sender);
                }
            }
            base.CleanUp();
        }
    }

Usage Example

示例#1
0
        public void CleanUp_drains_queue()
        {
            using (var loggerMailbox = new LoggerMailbox())
            {
                loggerMailbox.Post(TestActor, new Envelope {Message = "foo", Sender = TestActor});

                loggerMailbox.NumberOfMessages.ShouldBe(1);

                loggerMailbox.CleanUp();

                loggerMailbox.NumberOfMessages.ShouldBe(0);
            }
        }
All Usage Examples Of Akka.Event.LoggerMailbox::CleanUp
LoggerMailbox