Practice-inspired educational scenario
A service saved an order and assigned its number. The database transaction committed. It then tried to send an informational email synchronously, but the mail service returned an error. The email is not a condition for accepting the order. The current API nevertheless reports that the whole operation failed, so the user may submit again and create a duplicate. No durable task or confirmed queue message yet exists for retrying the notification.
What result would you return to the user, and what would you retry? Explain how you would avoid both a second order and a lost notification.
Guiding questions
- Which outcome has already been committed?
- Is retrying the whole request the same as retrying the email?
- What must be durable so a failure between the database and the queue cannot lose the notification?