Example #1
0
        private async Task NotifySubscriber(Message msg, Connection conn)
        {
            try
            {
                var notifier = new Notifier.NotifierClient(conn.GrpcChannel);
                var command  = new NotifyCommand {
                    Sensor = msg.Sensor, Data = msg.Data, ExecutorType = conn.ExecutorType
                };
                await notifier.NotifyAsync(command);
            }
            catch (RpcException e)
            {
                Console.WriteLine($"Could not send to {conn.Address} | {e.Message}");

                if (e.StatusCode == StatusCode.Internal)
                {
                    _connectionService.RemoveConnection(conn.Address);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Could not send to {conn.Address} | {e.Message}");
            }
        }