What Is a Message Queue?

Implementation of messaging protocols is a fundamental communication component for modern applications. Different application components require transmitting messages while ensuring reliable and efficient communication. A good example of ensuring reliable message exchange is implementing queues. Once a message is assigned to the queue, its destination is already established. This message will always get delivered. Moreover, if the destination is busy or not connected, the queue will hold that message until the destination gets back. You require a message queueing system to implement these advanced queuing operations like message persistence, message priority, scheduled messages, time-to-live, and so on. Let's dive into and understand message queueing in detail.

What Is a Message Queue?

A message contains a payload of the actual data being sent or received. These messages are sent by a producer and received by a consumer. On the other side, a queue stores and manages the flow of these messages in a sequential first-in, first-out (FIFO) order until a consumer retrieves them. It holds the messages waiting to be processed. These messages will then enqueued and dequeued in the order they are received to ensure asynchronous communication between the sender and the receiver.

Understanding a Messaging Queue by Example

What Is a Messaging Queue?

A message queue is a form of asynchronous service-to-service communication used in server-less and micro-services architectures. Messages are stored on the queue until they are processed and deleted.

Messaging Queue is a combination of two words — Message & Queue where:

Secure Communication with Token-based RSocket

RSocket provides a message-driven communication mechanism, by using the reactive streaming framework, and supports most of the protocols (TCP/WebSocket/HTTP 1.1&HTTP 2). Furthermore, it’s program language-agnostic interaction models (REQUEST_RESPONSE/REQUEST_FNF/REQUEST_STREAM/REQUEST_CHANNEL) cover most communication scenarios, from the Microservices, API Gateway, and Sidecar Proxy, to the Message Queue.

Considering security for the communication, it's easy to use TLS-based and Token-based solution in RSocket-based productions. RSocket can reuse the TLS over the TCP or WebSocket directly, but to demonstrate the RBAC feature vividly, in this article, we only talk about the token-based implementation.