expertAtomicity
How would you safely combine "update the database" and "call an external API" as one logical, all-or-nothing unit?
Don't call the external API inside the transaction at all — persist an event/outbox record in the same transaction (Chapter 18's Outbox Pattern) and have a separate process call the external API afterward, based on that durably-committed record.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response