Exemplo n.º 1
0
 private static void HandleStillDisabledEvent(StillDisabledEvent ev)
 {
     if (sensorDataDictionary.TryGetValue(ev.StillId, out var item))
     {
         item.Disable();
     }
 }
Exemplo n.º 2
0
        internal async Task DisableAsync()
        {
            Cts.Cancel();
            await Task;

            Task.Dispose();

            var stillDisabledEvent = new StillDisabledEvent(Id);

            Kafka.ProduceEventAsJson(nameof(StillDisabledEvent), stillDisabledEvent);
        }
Exemplo n.º 3
0
 private static void HandleStillDisabledEvent(StillDisabledEvent ev)
 {
     stillStatusDictionary.AddOrUpdate(key: ev.StillId,
                                       addValue: new StillStatus()
     {
         Id       = ev.StillId,
         Started  = ev.Occured,
         LastSeen = ev.Occured
     },
                                       updateValueFactory: (stillId, item) =>
     {
         return(new StillStatus()
         {
             Id = item.Id,
             Started = item.Started,
             LastSeen = ev.Occured > item.LastSeen ? ev.Occured : item.LastSeen,
             Disabled = ev.Occured
         });
     });
 }
Exemplo n.º 4
0
 private static void HandleStillDisabledEvent(StillDisabledEvent ev)
 {
     Misc.WriteLineInColor($"{DateTime.Now:yyyy/MM/dd hh:mm:ss.fff}: Still with id {ev.StillId} disabled at {ev.Occured:yyyy/MM/dd hh:mm:ss.fff}", ConsoleColor.Red);
 }