I am having a microserice architecture with multiple services, each containing their own Database, and a Gateway which is considered as the business logic.
Gateway:
- Handles the logic
- Calls the services
Service 1:
- Stores service related data
- Has it's own database
Service 2:
- Stores service related data
- Has it's own database
So for example Gateway calls Service 1 to insert some data. Then it calls Service 2 to also insert some data.
Now the problem: What if the call to Service 2 fails, how do I undo the insert to service 1? I know I could call a http://.../delete method, but this cannot be the best solution. So what is the best way to undo the changes?