3. Why message queues
Message queues can be used as a mechanism to allow
asynchronous request processing.
When we have a job with long processing time, we can use
message queue to hold the requests
Distribute a massage among multiple systems
When there are totally decoupled systems, we can use message
queues to communicate between the systems
4. Example :
A JMS client can use to watch for different log messages and send the
messages for the different log processes. We can have different log processing
systems to identify security threats, trends of user actions, system issues etc.
To process system logs and alert
events(part 1 - log processing)
Queue
Log producer 1
Log producer 2
Security check
Trend analyzer
Issue analyzer
5. Example :
Let’s consider security check process, If the security check detects any threat,
then it can alert relevant personal with sending emails. Same as the security
check process, others can also use queue for alerting.
QueueSecurity Check
Person 1
Person 2
Person 3
To process system logs and alert
events(part 2 - alerting)
6. When a client buy product from e-commerce web site, main goal of the system is to complete the transaction and
allocate a product for him. Other than that there will be minor goals like, Sending product details as a mail, including
client into the loyalty program of the company, save customer information etc. System can push customer
information into a queue and complete the main goal, then queue will distribute the details into other programs and
they will complete the minor tasks independently decoupling with main task.
Example : Asynchronous request processing
Queue
Product Detail Email
Loyalty program
Store customer info
Client
E-Commerce
web site
7. Example :
When clients requesting a process that consume lot of time, then we can push
requests into a queue and then process the request and send a response back
when the processes completed.
QueueClient Processing
Time consuming process
8. In a customer service there will be few employees to reply for all customer
complains. In here all the clients request are pushed to a queue and then one
by one client will connect with an employee.
Example : Customer service chat application
Queue
Employee 1
Employee 2
Employee 3
Client 1
Client 2
Client 3
9. Example :
When clients sending SMS to a SMS application, the request are pushed to a
queue and dequeue when the SMS application ready and send a response back
QueueSMS Request SMS App
SMS based application