Messaging queue

In modern cloud architecture, applications are decoupled into smaller, independent building blocks that are easier to develop, deploy and maintain. Message queues provide communication and coordination for these distributed applications. Message queues can significantly simplify the coding of decoupled applications while improving performance, reliability, and scalability.

Message queues allow different parts of a system to communicate and process operations asynchronously. A message queue provides a lightweight buffer that temporarily stores messages, and endpoints that allow software components to connect to the queue in order to send and receive messages. The messages are usually small and can be things like requests, replies, error messages, or just plain information. To send a message, a component called a producer adds a message to the queue. The message is stored on the queue until another component called a consumer retrieves the message and does something with it.

Types of Messaging Queues

As touched on above, there are two types of messaging queues: point-to-point queues and publish/subscribe queues. Here’s what you need to know about each.

Point-to-Point

  • Producers and consumers can use the queue at the same time.

  • Each message can only be processed once by a single consumer.

  • The producer must know the receiving application’s information, like the queue name, before it can send a message.

  • Messages may be received out of order.

Publish/Subscribe

  • A single message can be processed by more than one consumer.

  • Service-to-service communication is a method primarily used by serverless or microservice environments.

  • Message topics are used to broadcast messages to subscribers of that topic, who all receive the message.

  • Messages are received in the same order broadcasted.

  • Analyzing both types of messaging queues side by side is important, as each has its own set of use cases that are specific to what you’re trying to achieve.

  • Reference here for the above topic

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy