abuzaforfagun / Invoice.Microservices.ThirdPartyAPIIntegration

Scaleable fault tolerance microservices to communicate third party API
9 stars 3 forks source link

Fix #2 Remove single point of failure #4

Closed abuzaforfagun closed 2 years ago

abuzaforfagun commented 2 years ago

What is a Single Point of Failure?

When one of your microservice (ex. Reader) directly depends on another microservice (ex. Processor). It creates a single point of failure.

In the worst case (heavy load or other difficulties) Processor microservice could be unreachable. In that case, the Reader service would stop working, at least for some of the features. Also, it would be a performance leak for Reader service.

Previously in Invoice.Microservices.ThirdPartyAPIIntegration application, when a new invoice is added, I fire a queue to notify about that action first and do the invoice processing later on. And inside Reader microservice, I did the check to verify the status and do the following operation.

There is a reason behind this ugly operation, we need to call third party services, and our service bus could be unreachable. In that case, we lose the data consistency.

We can do the service bus call and third party service call inside a transaction. On service bus failure, it would not call the third party service and vice versa for third party service.

abuzaforfagun commented 2 years ago

Currently, we have OutboxController and corresponding features as dead code. I am going to keep this to make that an example of synchronize communication between microservices.