Message Queues – Asynchronous Messaging

19 June3 min read
Message Queues – Asynchronous Messaging

Message Queue is a form of asynchronous communication between a message producer and a message consumer. A message queue, as an entity, is a place where messages are stored, and it is placed between a message producer and a message consumer. Message content can be anything, depending on the problem being solved and how the programmer wants to solve it. For example, messages can contain some information, commands, HTTP requests and who knows what else. In this blog, I will discuss software, or its components, as message consumers or producers.

Asynchronous Messaging

Message queues allow asynchronous communication between consumer and producer, making this mechanism powerful. Asynchronous messaging means that the producer can send a message to the message queue and continue with their own work without thinking about the sent message. The sent message will be stored in the message queue until the consumer finds time to process that message. That means that producers do not need to wait for possibly busy consumers to process messages, which can speed up software.

Message Queue Variations

There are many message-queue software implementations that you can use for your software, and some may have some additional features compared to others. Although they can have different features, most support common message queue variations that allow this mechanism to be suitable for solving many problems. For example, you can have the following:

  • One producer and one consumer – a basic form of a message queue;
  • One producer and many consumers where the fastest consumer gets the message – good for sending commands;
  • One producer and many consumers where every consumer gets the message – this is known as publish/subscribe pattern;
  • Many producers and one/many consumers;
  • Consumers that can filter and pick up specific messages….etc.

The listed variations are common to message queue variations that can be combined to solve many complex problems.


There is a wide range of possibilities for message queue use. Some usual message queues usages:

  • Coordinate microservices in a distributed application – message queues are one of the best solutions to this problem because microservices are software components that work independently but often work together to accomplish a specific job. So, message queues would allow services to exchange messages with each other without waiting for a response, knowing that the message will be stored until the other side reads and processes the message.
  • To decouple heavy processing – spread one big job to many software components that will communicate through message queues.
  • To reduce system overload – online applications and systems can have periodic overload with requests that can cause applications to crash. A message queue would store, e.g., HTTP requests as messages, and the application would be the consumer that would pick up the request whenever it had the resources to process the subsequent request.

This list is not complete, and there are endless possibilities.

My Usage of Message Queues

I encountered the use of this mechanism at the very beginning of my career. I mostly used that for sending commands from one software component to another. The last time I used this mechanism, many producers created commands and put them as messages in message queues. On the other end, I had one consumer, as a separate software component, that waited for new messages. Upon arrival, the consumer would read the message and start the requested operation with the provided information. The idea behind using message queues was to decouple heavy processing because the consumer had to do a relatively slow job. We wanted that process to run independently of the application where the producers were, to keep our system fast.


As I said, the message queue mechanism is very powerful and can be used for solving various problems. It is not difficult to understand, and the main idea for writing this text is to encourage you to find out more about message queues if you have not heard about them before because you may come across a problem that can be solved with the help of this mechanism.