Should Microsercices be reusable? With reusable I do NOT mean sharing Domain specific Models.
I mean should a microservice created for one application be reuseable in another application? Is it sufficient if they are reusable within an application?
What is the best way to decouple microservices. From my point of view as soon a microservices calls another microservice it is tightly coupled, means it can not easily (without modifications) be extracted and put into another microservice application that does not have the same service it refers to/from.
To decouple them, in my opinion, there are following ways:
- microservice A needs to talk to the other microservice B with a
standard contract eg. a specfic protocol. - another Microservice C acts as a gateway and asks microservice B for the data and passes it as input to microservice A.
A concrete example for nr. 2 would be:
Coupled:
client -> API GateWay -> UserProfileService -> Authorization Service
Decoupled:
Client -> API Gateway -> Authorization Service -> API Gateway -> UserProfileService
Am I right assuming that this all boils down to the goal of the microservice? There is no wrong and right?
Are there any other strategies i'm missing to decouple a microservice?