Esempio n. 1
0
        public override void AfterSimulationStopped(Simulation sim)
        {
            var tasks = new List <Task>();

            foreach (var item in _collectorRefs)
            {
                var msg = UpdateLiveFeed.Create(setup: false, target: _inbox.Receiver);
                _logger.Log(LogLevel.Info, $"Ask for Update Feed {item.Path.Name}");
                tasks.Add(item.Ask(message: msg, timeout: TimeSpan.FromSeconds(value: 60 * 60)));
            }

            var hubActorRef = sim.ActorSystem.ActorSelection("/user/HubDirectory/CentralHub").ResolveOne(TimeSpan.FromSeconds(60)).Result;
            var instruction = Hub.Instruction.Central.LoadProductionOrders.Create(_inbox.Receiver, hubActorRef);

            sim.SimulationContext.Tell(instruction);

            Task.WaitAll(tasks.ToArray());
            //TODO might need to extend timespan
            var results = _inbox.ReceiveWhere(x => x is FCentralGanttPlanInformation, TimeSpan.FromSeconds(60 * 60)) as FCentralGanttPlanInformation;

            _messageHub.SendToClient("ganttListener", results.InfoJson);
        }