Messaging system of partial and out-of-order events
Methods, systems, and computer readable medium are provided for receiving an event message in a plurality of event messages, the event message comprising a sequence number and associated data, identifying the event message as an out-of-order event message based on the sequence number, assigning a priority level to the out-of-order event message based on a plurality of priority rules, and placing the out-of-order event message in a primary queue of messages based on the priority level assigned to the event message.
1 . A method, comprising:
receiving, via an Application Programming Interface (API), a message that includes a timestamp;
determining that the message is an out-of-order event message based on the timestamp; and
placing the out-of-order event message in a queue of messages based on a priority level assigned to the out-of-order event message.
2 . The method of claim 1 , wherein the queue of messages comprises a plurality of event messages, comprising:
assigning a priority level to the out-of-order event message based on a priority rule from a plurality of priority levels; and
sorting the plurality of event messages and the out-of-order event message based on the plurality of priority levels assigned to the plurality of event messages.
3 . The method of claim 2 , wherein the plurality of priority levels indicates a chronological order in which the plurality of event messages is sent from one or more client devices.
4 . The method of claim 1 , wherein the out-of-order event message is a first out-of-order event message, comprising:
receiving a second out-of-order event message;
identifying content data associated with the second out-of-order event message; and
determining that the content data indicates a data item associated with the second out-of-order event message is missing.
5 . The method of claim 4 , wherein the second out-of-order event message is received via the API.
6 . The method of claim 4 , comprising:
determining that the data item can be fetched from a database;
fetching the data item from the database; and
placing the second out-of-order event message in the queue of messages.
7 . The method of claim 4 , wherein the queue of messages is a first queue of messages, comprising:
determining that the data item cannot be fetched from a database; and
placing the second out-of-order event message in a second queue of messages, the second queue of messages being associated with a lower priority ranking in processing compared to the first queue of messages.
8 . The method of claim 7 , comprising:
receiving the data item associated with the second out-of-order event message; and
placing the second out-of-order event message in the first queue of messages for processing.
9 . The method of claim 1 , wherein the out-of-order event message comprises an entity identifier associated with a user that is absent from a conversation, comprising:
determining a data item associated with the out-of-order event message is missing, the data item corresponding to a system notification that indicates the user has left the conversation.
10 . The method of claim 9 , comprising:
determining that a user profile associated with the user can be fetched from a database;
fetching the user profile from the database;
generating the data item based on the user profile; and
writing the out-of-order event message to the database based on the data item.
11 . A system comprising:
a memory storing instructions; and
one or more hardware processors communicatively coupled to the memory and configured by the instructions to perform operations comprising:
receiving, via an Application Programming Interface (API), a message that includes a timestamp;
determining that the message is an out-of-order event message based on the timestamp; and
placing the out-of-order event message in a queue of messages based on a priority level assigned to the out-of-order event message.
12 . The system of claim 11 , wherein the queue of messages comprises a plurality of event messages, and wherein the operations comprise:
assigning a priority level to the out-of-order event message based on a priority rule from a plurality of priority levels; and
sorting the plurality of event messages and the out-of-order event message based on the plurality of priority levels assigned to the plurality of event messages.
13 . The system of claim 12 , wherein the plurality of priority levels indicates a chronological order in which the plurality of event messages is sent from one or more client devices.
14 . The system of claim 11 , wherein the out-of-order event message is a first out-of-order event message, and wherein the operations comprise:
receiving a second out-of-order event message;
identifying content data associated with the second out-of-order event message; and
determining that the content data indicates a data item associated with the second out-of-order event message is missing.
15 . The system of claim 14 , wherein the second out-of-order event message is received via the API.
16 . The system of claim 14 , wherein the operations comprise:
determining that the data item can be fetched from a database;
fetching the data item from the database; and
placing the second out-of-order event message in the queue of messages.
17 . The system of claim 14 , wherein the queue of messages is a first queue of messages, and wherein the operations comprise:
determining that the data item cannot be fetched from a database; and
placing the second out-of-order event message in a second queue of messages, the second queue of messages being associated with a lower priority ranking in processing compared to the first queue of messages.
18 . The system of claim 17 , wherein the operations comprise:
receiving the data item associated with the second out-of-order event message; and
placing the second out-of-order event message in the first queue of messages for processing.
19 . The system of claim 11 , wherein the out-of-order event message comprises an entity identifier associated with a user that is absent from a conversation, and wherein the operations comprise:
determining a data item associated with the out-of-order event message is missing, the data item corresponding to a system notification that indicates the user has left the conversation;
determining that a user profile associated with the user can be fetched from a database;
fetching the user profile from the database;
generating the data item based on the user profile; and
writing the out-of-order event message to the database based on the data item.
20 . A non-transitory computer-readable medium comprising instructions that, when executed by a hardware processor of a machine, cause the machine to perform operations comprising:
receiving, via an Application Programming Interface (API), a message that includes a timestamp;
determining that the message is an out-of-order event message based on the timestamp; and
placing the out-of-order event message in a queue of messages based on a priority level assigned to the out-of-order event message.