Orders and Payment service example is the most popular example on the internet.
Let's say we have Orders service and Payments service. When an order is placed, the Order service writes it to its database but the payment service must also write it to its own database in order for the transaction to be complete. Here is my understanding:
- User sends a place order request to Orchestrator
- Orchestrator invokes Orders service to as well as Payment service at the same time. Now according to what I have read, Order and Payment services are supposed to respond to Orchestrator by telling it whether or not they are ready. What does that mean? What does it mean to be ready here?
- Order and Payment service respond back, telling Orchestrator that they are "ready" (whatever that means).
- Orchestrator sends another request to both the services (commit request).
- Order writes the record to its database. The Payment service writes the record to its own database. They both respond back with status 200 to Orchestrator.
- Orchestrator checks if both of the participants have returned status code 200. If yes, then it does nothing. If no then it asks them to ABORT?? How? One of the participants already wrote the transaction to its database.