Esempio n. 1
0
 public AlertConsumer(IOptions <KafkaOpts> kafkaOptions, IAlertStream alertStream)
 {
     _kafkaConfig = new ConsumerConfig
     {
         GroupId          = kafkaOptions.Value.GroupId,
         BootstrapServers = kafkaOptions.Value.Host,
         AutoOffsetReset  = AutoOffsetReset.Earliest
     };
     _kafkaTopics = kafkaOptions.Value.Topic.Split(",").ToList();
     _alertStream = alertStream;
 }
Esempio n. 2
0
 public AlertRelay(IHubContext <AlertHub> hubContext, IAlertStream alertStream)
 {
     alertStream.Subscribe("alert_relay", async(alert) => await hubContext.Clients.All.SendAsync("alerts", alert.Message));
 }