locked
Problems when combining IoT Hub routes with Stream Analytics job RRS feed

  • Question

  • Dear all,

    I've been struggling to configure the mentioned combination on my Azure subscription.

    I have been able to create a Streaming Analytics job and connect my IotHub as the input and my SQL as output.

    Now I want to also use routes to differentiate normal messages from critical ones, but when I create a new route to transfer critical messages to a different Service Queue, and to continue to route the rest of the messages to the default destination (messages/events), what I've seen is that even when I send critical messages (it's just a property added to the message as described in different articles https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-process-d2c), they never get queued to my new critical queue.

    Is it possible that my Stream Analytics input (IoTHub) is reading all messages even before routing rules are applied?

    Many thanks!

    Wednesday, March 8, 2017 7:47 AM

All replies

  • Hi Manuel,

    Are you routing your critical message based on the message headers or on the message body? Routing is only based on message headers at the moment.

    best,

    Nicole

    Wednesday, March 8, 2017 6:30 PM
  • Hi Manuel,

    - could you show (describe) how the IoT Hub Routes has been setup?

    the following screen snippet is my example of the Routes Rule to my custom endpoint BA:

    and the following picture shows how the telemetry (D2C) message is routing in the IoT Hub:

     

    You can use the Device Explorer and Service Bus Explorer tools to see where the D2C messages are forwarding. Note, that all messages received by Device Explorer will continue to the ASA job.

    Thanks

    Roman



    • Edited by Roman Kiss Wednesday, March 8, 2017 8:21 PM
    Wednesday, March 8, 2017 8:19 PM
  • Thanks for the response.

    The property is in the message header:

    var message = new Message(Encoding.ASCII.GetBytes(messageString)); message.Properties.Add("level", "critical");

    Routing Query String:

    IS_DEFINED(level) AND level="critical"


    I think I understand how the Iot Hub Telemetry router works, but my question is whether the messages even arrive to the routing engine if I have also configured ASA directly into the IoT Hub.

    As soon as I'm verified I will attach screenshots of my route configuration and ASA Input.

    Many thanks.

    Regards

    


    Thursday, March 9, 2017 7:37 AM
  • Hi Manuel,

    - change your routing query string for:   level="critical"

    Note, that any D2C message with no properties or not match with a query string will ingested into the Default Event Hub such as known as IoT hub input for ASA job. In other words to your question, yes, you have to integrate ASA job with this source for streaming data.

    The following screen snippet shows an example of the integration ASA job with IoT Hub for data stream:

    Thanks

    Roman



    • Edited by Roman Kiss Thursday, March 9, 2017 1:36 PM
    Thursday, March 9, 2017 1:34 PM

  • I've got the same configuration already. I could not attach any screenshots as my account has not been validated yet (I requested it two days ago but still waiting).

    I'll try again this evening and update with the results.

    Thanks.

    Regards

    Friday, March 10, 2017 9:37 AM
  • Hi,

    I managed to solve the issue. The problem was not in the route nor the SAS, but on the wrong configuration of the Service Bus receiving the routed messages.

    Many thanks for all your support.

    Regards

    Friday, March 10, 2017 8:59 PM