Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API gateway and microservices communication

I am building microservices arhitecture and i need help with communication. What is best approach for API gateway to communicate with services ? My API gateway will be graphql apollo server and services will be REST APIs. Should i use REST to communicate with services or some message system like RabbitMQ ?

like image 449
Lule Avatar asked Oct 16 '22 15:10

Lule


1 Answers

You can do it both ways but using a message broker system like RabbitMQ will give you the advantage of load balancing. With HTTP rest communication, you need a load balancer so that traffic is distributed and routed to the various instances. But with a message broker like RabbitMQ, broker itself is the load balancer. If multiple consumers are listening same address at the same time messages will be delivered parallel instead of blocking each other as the behavior of HTTP. I hope I could explain it clearly :)

You can look at this article which explains the advantages.

like image 94
onuriltan Avatar answered Oct 20 '22 14:10

onuriltan