Page 1 of 1

[Message Queue Service] Are receiving messages sent sequentially?

Posted: 2024年 Aug 22日 19:17
by Tran Manh Duy

Hi Tuya-team,

I am running SDK Get Push Messages by Pulsar (Node.js SDK) : https://developer.tuya.com/en/docs/iot/ ... fmtxp8yscg. to get real-time messages from cloud project and then save it in database

Please let me know, Are the received messages sequential like the api call order?

For example, I follow the steps:

  • Step 1: I call api to create new home (home 1)
  • Step 2: I call api add room (room 1) into the home 1

Whether the received messages are in the correct order as

  • First: homeCreate: Create a home.
  • Second: roomCreate: Create a room.

Or in any order
(as sometimes homeCreate -> roomCreate, sometimes roomCreate -> homeCreate)

I want to save message data in the database (home table, room table), so the message order is important.
I insert home first and then insert room based on the existing home_id

Please let me know the answer or solution to get messages in order
Thanks so much


Re: [Message Queue Service] Are receiving messages sent sequentially?

Posted: 2024年 Aug 23日 10:31
by chufeng

Dear Developer,

In our system, data of the same type with the same ID is ordered, but if the data is of different types or has different IDs, the order may not be guaranteed.

For example, messages with room ID "a" will arrive in order, but for different room IDs, such as "a", "b", and "c", the sequence in which you receive these messages might vary.

Regarding the issue you raised, the messages come from different types—one is "home" and the other is "room"—so we cannot guarantee the order in which you receive these two messages.

However, under normal circumstances, a "home" is created first, and then a "room" is created under it with a time gap in between. Therefore, the likelihood of receiving the messages in order is higher.


Re: [Message Queue Service] Are receiving messages sent sequentially?

Posted: 2024年 Aug 23日 14:33
by Tran Manh Duy

I got it
Thanks so much