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); } }
public async Task <RoutingResponse> RouteAsync(ControlMessage data, CancellationToken ct) { var client = new EgressRouter.EgressRouterClient(this.m_channel); return(await client.EnqueueControlMessageAsync(data, cancellationToken : ct)); }