0

I have set a endpoint and a route on service bus with this criteria in query:

$body.Temperature.AlarmPrius = 1

where the format of message I set is like

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 is set as:

 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")}";           
    } 
}

but no message enters the service bus queue... I'm aware of other topics similar to mine (I use MQTT connection) and they suggest, like here, to use devices/{yourDeviceId}/messages/events/$.ct=application%2Fjson&$.ce=utf-8 but how can I implement this? any example?

Route

Lemon Pies
  • 55
  • 7
  • $body.Temperature.AlarmPrius doesn't match with your class ProbDATA. Try to use $body.Alarm_123 = 1 – Roman Kiss Nov 12 '18 at 12:10
  • update the Test/Message body with your body such as ProbDATA for testing purpose (Test route button). – Roman Kiss Nov 12 '18 at 12:19
  • Hi Roman, what you have suggested has already been tried and still the issue is present, also there is a bug where the "1" in Alarm_123 enters in conflict with the 1 assigned number. That's why I renominated it AlarmPrius anyway I'll try futher tests – Lemon Pies Nov 12 '18 at 13:11
  • I have just tested your payload ProbDATA and query $body.Alarm_123 = 1 and it's working well. – Roman Kiss Nov 12 '18 at 13:44
  • Ok, I have correct my query as $body.Alarm_123 but still no message is sent to service bus queue https://imgur.com/a/h8JWK6w , I'm desperate :( – Lemon Pies Nov 12 '18 at 14:12
  • 1
    for test purpose: set the query to true so, every message should be routed to your service bus queue. Also, add one more route for forwarding all messages (query is true) to the built-in endpoint (events) to see on the DeviceExplorer tool. Use also the Service Bus Explorer tool. – Roman Kiss Nov 12 '18 at 14:25

1 Answers1

0

Thanks to @roman Kiss I solved the issue, wich was a wrong written query.

correct one was query $body.Alarm_123 = 1. thanks again!

Lemon Pies
  • 55
  • 7