[Message Queue Service] Are receiving messages sent sequentially?

Developer Platform features usage and feedback.


Post Reply
Tran Manh Duy
Posts: 10

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

chufeng
Posts: 1

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

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.

Tran Manh Duy
Posts: 10

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

I got it
Thanks so much

Post Reply