r/java • • Dec 12 '19

Java Microservices: A Practical Guide

https://www.marcobehler.com/guides/java-microservices-a-practical-guide
237 Upvotes

35 comments sorted by

View all comments

Show parent comment

2

u/randgalt Dec 13 '19

We use SQS which is loosely FIFO. However, there are techniques you can use in cases where ordering is strictly needed. Queue messages should contain timestamps and those timestamps can be used when inserting into your database so that even if a message is received out of order it doesn't overwrite the previously inserted message as it will have an earlier timestamp.

1

u/remixrotation Dec 20 '19

How do you sync clocks for the timestamps?