The worker component need to know these details: account_id, card_id, amount (in dollars). Let's consider a use case where we have to recharge a customer's account. It contains all the information needed for the worker components to take actions. And there are consumers or worker processes which read those messages and take actions.Ī message is any data that is passed between two components. Generally in applications where message queues are used there are producers who create and put the messages into message queues. Message queues helps different components to communicate asynchronously by passing messages between them. It's basically the same concept as what we discussed in our ATM machine example.Ī message queue is basically a queuing service used in micro services & server-less architectures to decouple different components that are easier to develop, scale & maintain in the long term. If you have a computer science background you know how a queue data structure works: the first element pushed into the queue is the first item extracted. How are message queues used in a system?Ī queue is a First-In First-Out data structure.We will talk about below topics in this article: This is one real world example of queues and message queues serve the same purpose in any software architecture. So when many people want to withdraw money they will have to wait in a queue and go to the ATM machine in the same order in which they entered the queue. In this case, what do you do when you see there's a person already using the ATM machine? Do you wait in a queue or do you go back thinking you cannot withdraw money from this machine?Įxactly! You wait in a queue until your turn comes. ![]() An ATM machine can only allow one person to do transactions at a time. ![]() Let's say you want to withdraw some money from an ATM. In this article let's discuss what message queues are, how they're used in modern architectures and what problems do they solve. Message queues are one of the critical components in any software architecture which helps different components talk to each other asynchronously.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |