예제 #1
0
        public async Task RouteControlMessageAsync(ControlMessage msg, ControlMessageType type)
        {
            var controlMessage = new Contracts.DTO.ControlMessage {
                Data        = msg.Data,
                Timestamp   = Timestamp.FromDateTime(msg.Timestamp),
                SensorID    = msg.SensorId.ToString(),
                Destination = Convert.ToInt32(type)
            };

            var client = new EgressRouter.EgressRouterClient(this.m_channel);
            var result = await client.EnqueueControlMessageAsync(controlMessage, Metadata.Empty);

            if (result.Count < 1)
            {
                var guid = new Guid(result.ResponseID.Span.ToArray());
                this.m_logger.LogWarning("Unable to route actuator message with response ID: {guid}.", guid);
            }
        }
예제 #2
0
        public async Task <RoutingResponse> RouteAsync(ControlMessage data, CancellationToken ct)
        {
            var client = new EgressRouter.EgressRouterClient(this.m_channel);

            return(await client.EnqueueControlMessageAsync(data, cancellationToken : ct));
        }