Let's say we're talking about a webshop.
- Microservice 1: Manages products and their prices
- Microservice 2: Responsible for payment and checkout.
If a user wants to pay for a product, the payment service is invoked. The service has to return success or failure synchronously. Also the service has to guarantee to use the current prices.
So the current workflow passes the productIds to the payment service. The payment services queries the current price (from service 1 SYNCHRON). The payment service runs the payment process.
Workflow:
Caller (App) -> Payment service -> Product service -> Payment service -> Caller (App)
How could such a scenario be optimized to asynchronous communication? Or is synchronous communication through rest services the best way?