IoT Core Message Ordering


I am working on IoT project which require message order. Example I am monitoring elevator in the building. So when elevator moves from floor 1 to 10, I will receive MQTT message for each floor. My problem is: if Broker is not guarantee message sequence based on ACK, my simulation/consumer might get flor number as 1,2,3,[9],4,5,6,7,8,10. So this is kind of not real time monitoring. If this is the case what will be good solution to use instead of IoT Core? Should I go directly with AWS Kinesis Data Stream or any other alternative?

posta 2 anni fa662 visualizzazioni
1 Risposta
Risposta accettata

Hi Ozy, the solution depends on how long your consumer is willing to wait for out-of-order messages. E.g in your elevator example, if your elevator moves from floor 1 to 5 and your consumer receives events 1,2,3,5 .... 1h ... 4. Are you ok to wait for 1h before message 4 is unstuck and continue processing message 5? I advise to develop a consumer that can handle out-of-order messages, it makes the solution more robust.

That said, if you use a QoS1 on your client and the events are spaced (in the elevator example several seconds), the chance to get a message out-of-order from one elevator are very low. And if you add some kind of sequence number to the message payload {floor:one , seq:100} , {floor:two, seq:101},{floor:three, seq:102},{floor:five, seq:104} on the device side, you can detect an out-of-order message at the consumer side and trigger exception logic.

profile pictureAWS
con risposta 2 anni fa
profile picture
verificato 15 giorni fa
  • Jan_B, thanks for the explanation and no 1h even 10 sec delay is not acceptable. I have same kind of solution in mind to cover the unordered message as you explained perfectly(message is going to be QoS1 and will have timestamp and sequence number). Now I should either go with some custom handling : this depends on how often this problem will happen, is it %1 or less or %10 or more. Because I will have many moving targets and real time is very crucial. Or I can go with streaming to from device directly and get everything in order. I do have a question on the broker message delivery to subscriber but will ask that as separate question to keep the scope here, thank you for your time

    And thank you for explanation instead of just copy/pasting the document link :) AWS should know when we ask question here we already know where to find these docs, question is when we have done all these and need some experts idea instead of being broker to documents :)

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande