Skip to main content

Command Palette

Search for a command to run...

Messaging Queues & Enterprise Message Bus (EMB)

Published
3 min read

In simple way, a messaging queue is a holding area for the data (messages) being sent between two applications.

Rather than App A communicating directly with App B and waiting for a response, App A can simply put a message in the queue and go back to its work. App B can then retrieve that message when it’s ready.

It makes the sender and the receiver independent of each other.

One service says: “Here’s something that needs to be done”
Another service says: “I’ll handle it when I’m ready”

Why Messaging Queues Exist?

Problem solved: Without queues, applications would have to communicate directly with each other, leading to tight coupling, timing problems, and failure if the other application is down/busy.

How queues solve this problem:

  • Dealing with delays (the receiver might be busy or down).

  • Increasing reliability (messages won’t be lost).

  • Handling scaling (multiple consumers can handle messages concurrently).

Easy Examples

When a user sign up on website. Instead of immediately sending a welcome email, it places the task in a queue. The email service later processes it.

Technical (pseudo-code):

import queue

q = queue.Queue()
q.put("Send Welcome Email")   # Producer
task = q.get()                # Consumer
print(task)                   # "Send Welcome Email"

Core Principles

  • Asynchronous communication: Sender doesn’t wait for receiver.

  • Decoupling: Systems don’t need to know each other’s details.

  • Reliability: Messages are stored until delivered.

  • Scalability: Multiple consumers can share the workload.

  • Message-driven architecture : Systems react to events, not direct calls

Common use cases

Background jobs (emails, notifications)

Order processing

Payment workflows

Log and event processing

Data synchronization between systems

Microservices communication

Streaming analytics

Popular Tools

RabbitMQ: It is very reliable and good for the complex routing.

Apache Kafka: It is great for handling large amounts of data in real-time.

Amazon SQS: A cloud-based "set it and forget it" queue. No servers to manage.

Redis: While primarily a caching database, it has a "Pub/Sub" system that’s essentially a super-fast, lightweight queue.

What is an Enterprise Message Bus (EMB)?

An EMB is a centralized communication backbone that connects multiple applications and services within an organization.

How it Differs from a Queue:

A queue is point-to-point(one sender, one receiver).

A bus is many-to-many, supporting publish/subscribe patterns.

Queue = a single checkout line.

Bus = a city’s public transport system with multiple routes and stops.

Key Points :

  • Asynchronous: You don't have to wait for a response to keep moving.

  • Reliability: Messages stay in the queue even if the receiver is offline.

  • Scalability: If the queue gets too long, you can just add more "workers" (App Bs) to process them faster.

  • FIFO: Most queues follow "First In, First Out" logic.

References

https://www.geeksforgeeks.org/advance-java/introduction-to-messaging-queues-in-spring-boot-microservices/

https://aws.amazon.com/what-is/enterprise-service-bus/

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html

https://youtu.be/oUJbuFMyBDk (Best)

https://www.youtube.com/watch?v=XvnppkWqJbs