I am learning a microservice architecture and have created 3 microservices. Each ms has its own database.
Something like below,
- Business ms
- Customer ms
- Tax ms
I designed it in the way by duplicating the Business
table in all microservices. Whenever a new business is created in the Business ms, I wanted to update the business Id
and the name
in the Customers ms and the Tax ms to create a reference.
I tried to achieve this in the below way,
Hosted Service - This will be registered as part of the Business microservice and when a new row is added in the business table, I am adding that row to the
System.Threading.Channels
. HostedService will read the queue and then call Customers ms and the Tax ms API to update the Business Id and the Name.Event-Driven API - I've not achieved this yet. Idea is to have Business ms as the producer and Customer ms and the tax ms as the consumers.
What is the best approach to achieve this? Any ideas on this, please?