Message Queue — In a Nutshell

Photo by Chad Montano on Unsplash

What is a message queue?

A message queue is like a buffer that decouples sending and receiving of messages. It has:

Workflow:

When to use:

Patterns

The sender simply posts a message to the queue and leaves it to the receiver to process it at some point.

Sender posts a message to a queue and waits for an acknowledgment from the receiver. This is more reliable comparing to the above as the the sender can implement custom retry or error handling logic when no response coming back for a timespan.

However, this usually requires a separate communications channel in the form of a dedicated message queue to which the receiver can post its response messages.

E.g. the ReplyTo property from Azure Service Bus Queues

The sender posts a message to a queue, and multiple receivers can read a copy of the message. This often works with publisher/subscriber model together.

Some filtering mechanism is possible with the message metadata, e.g. a message labeled as “red” sent to receiver A and “blue” to receiver B.

Source:

That’s it!

Happy Reading!