Search code examples
architecturemicroservicesseparation-of-concerns

Micro-service architecture need advice


We work in agile mode with two different teams/applications, we are facing a new situation and we need your advice. The front-end of the application A (developed by team A) is now needing a service from micro-service B (which is developed by team B). Should the front-end A directly ask the micro-service B or would you prefer that it goes through micro-service A ? is it a matter of separation of concerns here ?

Help/advise would be highly appreciated.

Thanx a lot!!

enter image description here


Solution

  • Front-end A should call Microservice B directly. As in your solution 2.

    Simplifying, microservice architectures are supposed to be composed of small services that provide single functions in a self contained and self manage way.

    By having your solution 1, you break that principle.

    MicroserviceA does not need to call Microservice B to perform its function. Frontend A needs it. Keep microservices simple and focused, otherwise you're not doing microservice architecture, you're doing something else.

    The best way to approach a microservice architecture is to approach each microservice functionality in isolation, as if it was the only microservice that exists and then add dependencies (calls to other microservices) on demand, don't consider the needs of the clients of your microservice, think about what that particular service offers.