Order service whose database write succeeds but queue publish fails
Design the order path of an online bookstore. When an order request arrives, the service inserts the order into its database and then publishes a message to a queue (Amazon SQS) so other parts of the system can process the order asynchronously.
- The database insert succeeds but the publish fails. What goes wrong, and how do you make sure every saved order is eventually published?
- Consumers can receive the same message more than once. How do you keep an order from being processed twice?
No answer yet. Write the first one; the best answer gets endorsed.
