Sharing dependencies using older techniques
In the n-tier architecture, each layer has a direct reference to the other layer, which makes it tightly coupled and dependent. With microservices, this is one of the anti-patterns. There are cases where one service needs to call another service to complete a transaction. In this case, the service is dependent on the other service. To overcome this challenge, you can build self-contained services.
Building self-contained services
Self-contained services help you collaborate with other services using patterns such as Saga and CQRS. Instead of making direct HTTP calls, the source service communicates with the other service over a message broker. The source service publishes a message, and the other service reads the message and responds. One approach is to keep two queues for requests and responses. That way, both services can communicate asynchronously over this channel.
The following diagram shows the collaboration between services...