dimanche 20 août 2023

Design pattern to ensure do something & write database success

Assuming I want to build a cinema aggregator app, I have a transaction database. I want to save the state after the customer makes a booking.

So the flow will be like, init the data, make a book to my supplier by HTTP call, then update the data in the database

if the HTTP call is a success, it's ok, but the problem is when the HTTP call succeeds but the app fails to update the transaction status in the database.

is there any design pattern to use, to make sure the update operation is success when the HTTP call is success?

Aucun commentaire:

Enregistrer un commentaire