Reputation: 192
I am writing a microservice app by spring boot and spring cloud. I have five modules which are
All requests which come from users route to API gateway and through API gateway send to app A or B or C (these are not exposed out). Now I have a question, base on one business role, app A will need to call one rest endpoint of app B. Which approach is the best? I call app B endpoint from app A directly or I call by API-Gateway?
Upvotes: 1
Views: 92
Reputation: 107
For inter service communication, API gateway could be your entry point if you want to apply central security policy viz. API authentication, web firewall rules to sanitize requests, resource access policy based on IP address or roles etc.
Also, I assume you intend to route requests through discovery service which again need to be integrated directly in each of the dependent microservices if you don't follow the request route through API gateway.
Upvotes: 1
Reputation: 4691
If I were you I'll use a message broker for microservices communication. Let the api gateway for external clients. I think we overuse the http protocol. With a microservice architecture we should try to think differently.
Upvotes: 0
Reputation: 4055
The API Gateway should serve as an ingress layer, it only accepts traffic which is coming from outside of your application (clients / external integrations). More details here.
Any internal communication between your microservices, should be a point-to-point interaction, that can be done in multiple ways. This answer describes that in more details.
So the API Gateway should not be concerned with orchestration of the microservices.
Upvotes: 1