Published on

Redis Message Queue

Authors
redis-sets

A message queue is a queue of messages sent between applications. It includes a sequence of work objects that are waiting to be processed. ... Another application, called a consumer, connects to the queue and gets the messages to be processed. Messages placed onto the queue are stored until the consumer retrieves them.

In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication, or for inter-thread communication within the same process. They use a queue for messaging – the passing of control or of content.

Modern software applications have moved from being a single monolithic unit to loosely coupled collections of services. While this new architecture brings many benefits, those services still need to interact with each other, creating the need for robust and efficient messaging solutions. Read More

  1. Subscribing to a channel A user can subscribe to a channel using the SUBSCRIBE command. This command takes the name of the channel as an argument
SUBSCRIBE channelName
  1. Publishing to a channel A user can publish to a channel using the PUBLISH command.
PUBLISH channel message
  1. A channel with multiple subscribers It is possible for different clients to subscribe to the same channel. Whenever a publisher publishes this channel, all the receivers receive the message.

  2. Unsubscribing from a channel in Redis A client can easily unsubscribe from a channel using the UNSUBSCRIBE command.

UNSUBSCRIBE channelName
  1. Subscribing to a group of channels If a client wants to subscribe to all the channels starting with a particular character or string, they can use the PSUBSCRIBE command.
PSUBSCRIBE string*
  1. Unsubscribing from a group of channels A client can unsubscribe to a group of channels using PUNSUBSCRIBE command.
PUNSUBSCRIBE string*