Re:You Cannot Have Exactly-Once Delivery
by preseinger on Wednesday March 01, 2023 @07:53PM
(#34990532)
exactly once delivery is not satisfied if the same message is delivered to the recipient multiple times
Re:You Cannot Have Exactly-Once Delivery
by jongjong on Wednesday March 01, 2023 @08:06PM
(#34990631)
It depends on your definition of 'recipient' and 'delivery'. If you assume that the receiver is a specific database instance (or shard) or a specific data store (on the receiver side), then it's totally possible to have exactly once delivery in the sense that each message sent would end up being inserted into the database/data store exactly once without duplicates.
Re:You Cannot Have Exactly-Once Delivery
by preseinger on Wednesday March 01, 2023 @08:25PM
(#34990756)
but you can't make those assumptions, in general
If you assume that the sender cannot be trusted to not reuse a single UUID for multiple messages (e.g. to trick the receiver), you can still work around that limitation by computing and comparing message hashes (e.g. sha256) on the receiver side... Don't even need UUIDs. Every time you receive a message, you can hash it and check if you're received a message with this hash before (storing the hash of each message as it is received). You can use the hash in place of a UUID though in this case you probably need to add some index to each message to ensure that each hash is unique over time (since a message with the exact same payload will be counted as the same message, even if broadcast a long time apart).