Ends in:
7 DAYS
15 HRS
2 MIN
48 SEC
Ends in:
7 D
15 H
2 M
48 S
Open Closed

understanding design of Synchronous Communication between Microservices #6302


User avatar
0
smansuri created
  • ABP Framework version: v7.3.2
  • UI Type: Angular
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): Auth Server Separated (for Angular)
  • Exception message and full stack trace: NA
  • Steps to reproduce the issue: trying to achieve synchronous communication between microservices
  • i have gone through url : https://docs.abp.io/en/commercial/latest/startup-templates/microservice/synchronous-interservice-communication for achieving the intercommunication between micro services. i see we have add few contracts and project references to achieve this. but one thing i do not understand is why we have to add contracts and project references as a micro service always exposes endpoints as api endpoints and we can directly call this API endpoints. Can you help me understand this design. Also if you can help us if there is a way to directly call the api endpoint of the microservice without adding contracts and project references.

1 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Hello,

    This is from CSharp Api Clients.

    Without using the ABP, what we normally do is; we create an HTTPClient and serialize request and make the request to the url of the microservice that we should already be aware of. Then deserialize the result and use it.

    What ABP provides is the HttpApi.Client layer which contains information (via the static proxy) about the ApplicationService interface with the related DTOs. So, when you reference to the HttpApi.Client layer of a microservice from an other microservice, you can use the application services without worrying about deserializing, dto duplicating or versioning.

    Ideally, you can publish the HttpApi.Client projects as nuget packages to your private nuget server to decouple it. It will also provide versioning when you start using it as PackageReference instead of ProjectReference.

    This is the design and you can learn more on https://docs.abp.io/en/abp/latest/Best-Practices/Module-Architecture.

    You are also free not to use it though.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06