Implementing event-driven patterns
Event-driven patterns address the observer model of communication to send messages among microservices. The messages are sent and received through a message broker that acts as a connecting bridge between the sender and the receiver. In a microservices architecture, these messages may be generated as events as an outcome of the action taken by the microservice. Messages for which the source microservice does not expect a response from the target service can be published as events asynchronously, instead of sending them over a REST API for direct communication. Since it is not a direct communication, an event can be published once and consumed by more than one microservice that has subscribed to receive it. Moreover, the sender does not get blocked by the receiver for each event that is published.
Message brokers also help to build a resilient architecture for event-driven communication as receivers need not be available while the event is being produced...