I've been reading up on Microservice Architecture But I still can't understand the inter-microservices communication mechanism.
In many articles they said that microservices are usually exposed over a RESTful API. But when you search the internet you always see implementations based on messaging and events for the backend communications.
So I'm confused, Is REST API a standard for all the microservices or we can see microservices without a REST endpoints.
If you're communicating between services internally (within your Docker host or microservices cluster), you might also want to use binary format communication mechanisms (like WCF using TCP and binary format). Alternatively, you can use asynchronous, message-based communication mechanisms such as AMQP.
Because microservices are distributed and microservices communicate with each other by inter-service communication on network level. Each microservice has its own instance and process. Therefore, services must interact using an inter-service communication protocols like HTTP, gRPC or message brokers AMQP protocol.
There are two basic forms of microservice communication: synchronous and asynchronous.
For your problem , first lets understand the ways in which one service interacts with each other , lets create two service order service and customer service :
In this case sync communication needs to be imitated , one direct approach is rest or protobuff , or imitate it through messaging
Your third question is , is it possible to have service with no rest endpoint ::: yes its possible , but every service needs to be reachable . So use rest or other form is needed
Above mentioned link : microservices.io is very good , go through it once again
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With