private void StartHeartBeat(object msg)
        {
            Apply = DoLog;
            var heartBeat = new HeartBeatActor(500);

            heartBeat.SendMessage(LinkedActor);
        }
Esempio n. 2
0
        public LoggerActor(string aFileName) : base()
        {
            Become(new LoggerBehaviors(aFileName));
            var heartBeat = new HeartBeatActor(500);

            heartBeat.SendMessage((IActor)this);
            SendMessage("Logging start");
        }
        public void HeartBeatActorTest()
        {
            var heartBeat            = new HeartBeatActor(5000);
            TestHeartBeatActor actor = new TestHeartBeatActor();

            TestLauncherActor.Test(
                () =>
            {
                heartBeat.SendMessage(actor);
                Task.Delay(1000).Wait();
                Assert.IsTrue(actor.fHeartBeatReceive);
                actor.fHeartBeatReceive = false;
                heartBeat.SendMessage(actor);
                Task.Delay(1000).Wait();
                Assert.IsFalse(actor.fHeartBeatReceive);
                Task.Delay(5000).Wait();
                Assert.IsTrue(actor.fHeartBeatReceive);
            }
                , 20000);
        }