Microservices with Clojure
上QQ阅读APP看书,第一时间看更新

Messaging and contracts

In monolithic applications, messaging between components is mostly achieved using function calls, whereas for microservices, it is achieved using lightweight messaging systems, often HTTP(S). Using a lightweight messaging system is one of the most promising features of microservices and makes it easier to adopt and scale, as compared to service-oriented architecture (SOA) that uses a complex messaging system with multiple protocols. Microservices are more about keeping the endpoints smart and the communication channels as simple as possible.

In a microservices architecture, often multiple microservices need to interact with each other to achieve a particular task. These interactions can be either direct, via request-response-based (https://en.wikipedia.org/wiki/Request-response) communication, or through a lightweight message-oriented middleware (MOM) (https://en.wikipedia.org/wiki/Message-oriented_middleware). Direct messaging is synchronous, that is, the requester waits for the response to be returned, whereas a message-oriented middleware is primarily used for asynchronous communication.