
- Microservices Design Patterns Tutorial
- Microservices Design Patterns - Home
- Microservices Design Patterns - Overview
- Decomposition Design Patterns
- Decompose by Business Capability
- Decompose by Subdomain
- Decompose by Strangler
- Integration Design Patterns
- API Gateway
- Aggregator
- Proxy
- Client Side UI Composition
- Chain Of Responsibilities
- Branch
- Database Design Patterns
- Database per Service
- Shared Database per Service
- Command Query Responsibility Segregator
- Saga
- Aysynchronous Messaging
- Event Sourcing
- Observability Design Patterns
- Log Aggregation
- Performance Metrics
- Distributed Tracing
- Health Check
- Cross Cutting Concern Design Patterns
- External Configuration
- Service Discovery
- Circuit Breaker
- Blue Green Deployment
- Useful Resources
- Quick Guide
- Useful Resources
- Discussion
Aynchronous Messaging
Problem Statement
Microservice architecture structures an application as a set of loosely coupled microservices and each service can be developed independently in agile manner to enable continous delivery/deployment. Microservices handle requests from clients and often need to communicate with other microservices to fulfill the requests. So there is a requirement for inter-process communication protocol.
Solution
We can use Aynchronous Messaging Pattern for inter service communication as using synchronous communication will result in tight coupling of services and also requires both client and service to be available during request.
Using Aynchronous Messaging, a service can communicate by exchanging messages over messaging channels. Following are some of the different ways of asynchronous messaging communications.
Request / Synchronous Response − In this method, service makes a request to another service and expects a reply promptly.
Notifications − In this method, service sends a message to a recipient but is not expecting any response. Recipient is not expected to send a response as well.
Request / Aynchronous Response − In this method, service makes a request to another service and expects a reply within reasonable timeframe.
Publish / Subscribe − In this method, service publishes a message to zero or more recipients. Services which subscribe the message will receive the same. No response needed.
Publish / Aynchronous Response − In this method, service publishes a message to zero or more recipients. Services which subscribe the message will receive the same. Some of the them sends back an acknowledgement/reply.
Example
RabbitMQ and Apache Kafka are good examples of asynchronous messaging in microservices arena.