aspnetrun/run-aspnetcore-microservices

Communication Between two microservices using ASP.Net Core WebApi

kmuthugtk opened this issue · 1 comments

I have two Microservices. First Service for Customers and Second service for Invoice Service.

In Invoice MicroService, I will save only CustomerId in Invoice services. Using this CustomerId, I would like to retrieve all the related data for Customer Microservice. But i don't know to communicate async.

Any please get me some ideas and examples

You cant make async communicate in that case. this is the topic that data management in microservices. there are several best practices that you can use. my recommendation is duplicate customer data in invoice microservice and update customer data async when it is changed in customer microservice by triggering an event to event bus.

https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/distributed-data

https://developers.redhat.com/blog/2019/05/23/data-as-a-microservice-distributed-data-focused-integration/

https://blog.christianposta.com/microservices/the-hardest-part-about-microservices-data/