Chapter 4: Building a Service in .NET Core and Exploring Dapr
When developing applications based on microservices architecture, the communication between services can be synchronous or asynchronous. Since each service is hosted as a separate process and is exposed over an HTTP endpoint, the integration with other services can be done over an HTTP/HTTPS protocol.
In the case of a distributed transaction, where a single transaction spans to multiple services, calling services synchronously over an HTTP request/response channel is not the best approach. If any service fails, it may fail the whole transaction. Secondly, if each service takes a long time to execute a request, it may result in a request timeout and the transaction would end unexpectedly. There are multiple ways to overcome this challenge, one of which is the message broker technique, which relies on a pub/sub communication model. In the pub/sub model, a source service publishes a message to a queue that is listened to...