locked
Azure Stream Analytics & Event Ordering RRS feed

  • Question

  •  am trying to set up a ASA job. My use case is that, I receive telemetry data from vehicles in the field. They transmit various attributes of the vehicle. e.g. Engine currently on or off.


    This data goes to IoT Hub and then ASA consumes it.

    My problem is with the inputs coming out of sequence. For example, in the above diagram #9 came before #8.

    He is my ASA Query

    With AllSpeeder AS {
    SELECT
        telemetry.deviceId as vehicleid,
        telemetry.enginestatus as currentenginestatus,
        telemetry.datetime as currenttime,
        Last(telemetry.containerdt) over (partition by telemetry.vehicleid limit duration(day,7) 
              when (telemetry.enginestatus = 'On2Off')) as engineontime
    FROM
        theiot
    Timestamp by cast ( telemetry.containerdt as datetime)
    where
        telemetry.enginestatus = 'Off' or telemetry.enginestatus = 'On2Off' 
    }
    
     SELECT * INTO theblob FROM AllSpeeder 

    But the above query (TimeStamp by) did not fix it.

    I experimented with Event Order in ASA But still 8 and 9 above are not getting reordered.



    • Edited by naseemm Saturday, October 20, 2018 12:19 PM incorrect image uploaded
    Saturday, October 20, 2018 6:49 AM

Answers

  • You probably need to set "Late arrival" tolerance to some value greater than zero. This setting controls what is maximum allowed difference between TIMESTAMP BY time (containerdt in your case) and the time event was received by IotHub (you can get it using EventEnqueuedUtcTime system property in the query).
    • Marked as answer by naseemm Sunday, October 21, 2018 5:27 AM
    Saturday, October 20, 2018 5:47 PM

All replies

  • You probably need to set "Late arrival" tolerance to some value greater than zero. This setting controls what is maximum allowed difference between TIMESTAMP BY time (containerdt in your case) and the time event was received by IotHub (you can get it using EventEnqueuedUtcTime system property in the query).
    • Marked as answer by naseemm Sunday, October 21, 2018 5:27 AM
    Saturday, October 20, 2018 5:47 PM
  • It seems to be working now after I changed the Event Ordering as shown below.

    Also below is the 

    "eventenqueuedutctime":"03:40:59.8110000Z",

    "currenttime":"03:40:36.8039682" // this is the time sent from my Simulator.

    There is almost 14 seconds delay. 

    Sunday, October 21, 2018 5:27 AM
  • Do you mind answering this on stackoverflow also? I wil mark it as answer there after your reply. thanks
    Sunday, October 21, 2018 5:29 AM