我已在查询中使用以下条件在服务总线上设置了端点和路由:
$body.Temperature.AlarmPrius = 1
我设置的消息格式类似于
public async void InvioDati(ProbDATA msgRicevuto)
{
var messageString = JsonConvert.SerializeObject(msgRicevuto);
var message = new Message(Encoding.UTF8.GetBytes(messageString));
message.ContentType = "application/json";
message.ContentEncoding = "utf-8";
await dispositivo.SendEventAsync(message);
}
}
ProbDATA设置为:
public class ProbDATA
{
public int ID { get; set; }
public int Funzione { get; set; }
/******/
public int Registro_1 { get; set; }
/******/
public int Registro_2 { get; set; }
/******/
public int Registro_3 { get; set; }
/******/
public int Alarm_123 { get; set; }
/******/
public int Registro_4 { get; set; }
/******/
public int Alarm_4 { get; set; }
/******/
public DateTime _TimeStamp { get; set; }
/******/
public override string ToString()
{
return $"Temperature ::ID {ID.ToString()}, Funzione {Funzione.ToString()}, Registro_1 {Registro_1.ToString()}, Registro_2 {Registro_2.ToString()}, Registro_3 {Registro_3.ToString()}, AlarmPrius {Alarm_123.ToString()}, Registro_4 {Registro_4.ToString()}, Alarm_4 {Alarm_4.ToString()}, _TimeStamp {_TimeStamp.ToString("yyyy-MM-dd HH:mm:ss")}";
}
}
但没有消息进入服务总线队列...我知道其他与我类似的主题(我使用MQTT连接),他们建议像here一样使用devices/{yourDeviceId}/messages/events/$.ct=application%2Fjson&$.ce=utf-8
,但是如何使用我可以实现吗?有什么例子吗?
答案 0 :(得分:0)
感谢@roman Kiss我解决了这个问题,但那是一个错误的书面查询。
正确的是查询$ body.Alarm_123 =1。再次感谢!