
What is Asynchronous Messaging Design Pattern?
What is Asynchronous Messaging Design Pattern?
Previously we saw about What is Microservice? and the principles followed while developing MSA and the available design patterns. also, we saw an API Gateway design pattern.
Today we will see what is Asynchronous Messaging Design Pattern is.
What is Asynchronous Messaging Design Pattern?
Previously we saw about Chained or Chain of responsibility design pattern which makes the client wait for a long time, It also breaks the chain if any one service goes down and cause a bad experience for the clients.
To avoid such bad experiences for the client, The Asynchronous design pattern can be used, which communicate with the available services using message queue or event driven approach and not sequentially.
Yes, Messaging or events, The Asynchronous design pattern uses the Messaging Queue (MQ) or Event driven like ActiveMQ, RabbitMQ, Kafka and other tools for its communication with other services.
Example:
Consider we have Cart, Product, Stock, Order & Shipping services.
When the Product is added to the Cart, Stock must be updated accordingly, So the Product calls stock via Message Queue.
And then Order calls shipment via Message Queue to prepare a label for shipment.
This way the client need not wait for the flow of service to be completed to get the response immediately.

WeCanCode-Author
November 11, 2021
Senior Developer | Java & C#.NET | 10++ years of IT experience.
Planning to learn ReactJS or Angular or Flutter.!