Пример #1
0
        static async Task Main()
        {
            using (var system = ActorSystem.Create("pipeline")) {
                IActorRef sensorArea      = system.ActorOf(SensorAreaActor.Props("North"), "north-area");
                IActorRef safetyEvaluator = system.ActorOf(SafetyEvaluatorActor.Props(sensorArea), "safety-evaluator");

                IActorRef listener = system.ActorOf(SafetyWarningListener.Props(), "safety-listener");
                safetyEvaluator.Tell(new SubscribeToNotificationsRequest(new CorrelationId()), listener);

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Press 'q' to quit");

                await CreateFakeSensorInput(sensorArea, TimeSpan.FromSeconds(1));

                while (true)
                {
                    ConsoleKeyInfo cmd = Console.ReadKey();

                    if (cmd.KeyChar == 'q' || cmd.KeyChar == 'Q')
                    {
                        Environment.Exit(0);
                    }
                }
            }
        }
Пример #2
0
 protected IActorRef CreateFakeSafetyEvaluator(IActorRef areaActor)
 {
     return(Sys.ActorOf(SafetyEvaluatorActor.Props(areaActor, () => { })));
 }