You can use Amazon SNS FIFO (first in, first out) topics and Amazon Simple Queue Service (Amazon SQS) FIFO queues together to provide strict message ordering and message deduplication
AWS documentation
While, SQS FIFO queues were introduced in 2016, SNS FIFO capabilities were introduced only on October 2020.
This capability is important for cases in which the order matters. E.g. bank transactions were you commit a transaction only if the balance remains non-negative.
Messages are grouped and ordered according to the message group ID
. When sending a message you must specify a message group ID otherwise the action fails. If all the messages have the same message group ID then all the messages are sent and received in strict order. The message group id can be any value, e.g 12, “hello”, “user_id-123”, etc.
Note that as in the SQS case, the topic name must end with .fifo
, a limitation that counts to the 80 characters restriction as well.
For further reading –
One thought on “Things I learned today (21/07/2021)”