Message Queues
Message Queues :
Synchronous & Asynchronous Communication :
Both parties are connected with each other over the dedicated line and they are responding each other / exchanging the information in Synchronous manner there is no wait & lag any of the parties whether the Receive the message or Send the Response
Continuous exchange of information Is not necessary Asynchronous Communication
Message Queues :
Queue – Could be a process which has data structure and memory to store the messages it could be a process running on the same machine as the component which are interacting with queue , it could be a process running on the different machine and the components have to interact with different machine
Ex : SQS , Kafka , RabbitMq
Queue consist of Messages , Messages are short size of data which just tell what task has been done / what task has accomplished
Components which are talk to Queue is Producers , Consumers
Producers(Send message to queue) – Its an component its tells what’s has to be done
Consumers(carry out the particular operation) – Carry out the task which is mention in the message
Advantage : Handle the lot of request
The Producers keep pushing the request , the Consumer can keep processing the request
When the Consumers Stop working like its goes down the message remain in the Queue
Ordering & Consumption
Consumption – One to One , the message pushed by the producers in the queue will be consumed only once , once the message consumed by the consumer it will be removed from an Queue
Ordering – Its describes that whether your message could be ordered or not.
Ordered Queues – First In First Out
Ex : if we have consumer C1 he is access the Message M1,M2,M3,M4,M5,M6 …..
In Order way its accessing C1 – M1 , C1- M2 , C1 – M3 , C1 – M4 , but now M5 has failed so what will happen in Order queue will stop the message because M5 got failed it will stop that the Consumer won’t get any message after M4
Un-Ordered Queue :
Ex : if we have consumer C1 he is access the Message M1,M2,M3,M4,M5,M6 …..
In Order way its accessing C1 – M1 , C1- M2 , C1 – M3 , C1 – M4 , but now M5 has failed so what will happen in Un-Ordered queue , this M5 will be pushed into Retry or Failed Queue (Dead later Queue) , now the consumer will consume M6 , M7 etc..
Pattern In Message Queues :
Pub Sub Messaging : Publisher Subscriber
Its an pattern for Asynchronous Communication
Analogy of Pub Sub Model :
Since There is an Single Consumer for any particular Queue , hence this can be viewed as Producer / Consumer Model
A group of Consumers subscribes to a message its called Pub/Sub Model
Subscribe to my newsletter
Read articles from OBULIPURUSOTHAMAN K directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
OBULIPURUSOTHAMAN K
OBULIPURUSOTHAMAN K
As a Computer Science and Engineering graduate, I have cultivated a deep understanding of software development principles and technologies. With a strong foundation in Java programming, coupled with expertise in frontend and backend development, I thrive in crafting robust and scalable solutions. Currently, I am leveraging my skills as a Java Full Stack Engineer at Cognizant, where I am involved in designing and implementing end-to-end solutions that meet the complex requirements of our clients. I am passionate about leveraging emerging technologies to drive innovation and deliver tangible business value. My goal is to continually enhance my expertise and contribute to the advancement of software engineering practices in the industry.