IoT Core Message Ordering

0

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?

질문됨 2년 전653회 조회
1개 답변
0
수락된 답변

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
전문가
Jan_B
답변함 2년 전
profile picture
전문가
A_J
검토됨 8일 전
  • 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 :)

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인