DEV Community

Discussion on: How to do microservices?

Collapse
ossycodes profile image
Ossycodes • Edited on

Okay well, they are basically two major ways of inter communication between your microservices

  1. it can either be by using RPC(Remote Procedure Call) (which is been used here in yours, that is making HTTP requests to other microservices), I would advise you use this method of inter communication when what you need to do with the other microservice is synchronous and needed immediately eg fetching all Posts from the Post microservice.

  2. Advanced Messaging Queuing Protocol, which I would advise you use when one microservice needs to communicate with another in an asynchronous manner, eg Your User microservice needs to send an email to a registered user, this email should be sent in the background (asynchronously) by the Email microservice, hence you can use AMQP to communicate/send this newly registered email to the email microservice(there is library for this for php, and a wrapper package for Laravel/Lumen).

But in General if your application is small then just go for the regular monolith, if it's complex then consider the Microservice architecture.