Transaction

With our foreign keys gone and the database split into smaller parts, we need to devise our own mechanisms for handling data integrity. Here, we need to factor in the possibility that not all services would successfully go through a transaction for the scope of their respective data stores.

A good example could be a user ordering a specific product. At the time the order is being accepted, there is sufficient quantity available to be ordered. However, by the time the order is logged, the Product service could not log the orders for some reason. We don't know yet whether this was due to insufficient quantity or some other communication fault within the system. There are two possible options here. Let's discuss them one by one. ...

Get Building Microservices with .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.