I am in the design phase, several of the microservices of my architecture depend on other external rest services.
how to share the logic of external services? should I create a shared library or create a service?
CodePudding user response:
Normally it would be another microservice that would reside on layer 4 where:
Layer 1 - Clients
Layer 2 - BFF
Layer 3 - Business services and
Layer 4 - External services
CodePudding user response:
Welcome to Stackoverflow! This is not a question that has a generic answer. The devil lies in the details (like so often). Some of the factors that a sane answer would depend on are:
- What is the nature (business purpose) of your services vs. the external services? How closely are they related?
- Will you require a separate team take care of developing and maintaining the external service connections? How large will your overall development be?
- What is the frequency & expected call volume? Is there a need for separate scalability from your own services?
- What is the expected rate of change in the external interfaces? Will changes in the interfaces impact your internal view of those external services? Would it be ok that various internal services call different versions of the external service?
- Will the external service connection benefit from separate development / release / deployment cycles?
- Are there any restrictions / constraints from the external side?
- Is there persistence involved that is needed just for the external service connection?
- Do multiple external services fall into the same/similar category and could be bundled?
Maybe those questions help you reason about your scenario. And if you would like to give us more information someone could add more thoughts about your specific scenario.