Redis Publish/Subscribe

  • Allows to create simple message buses
  • It allows you to
    • PUBLISH message to the channel
    • and SUBSCRIBE to messages from channel
  • It’s fire and forget messages
  • Redis acts as a central broker for multiple clients providing
    • Simple method to post messages
    • and consume messages

Publish and Subscribe example :

Seeing the same messgae on telnet

1st Setup the telnet

2nd Send the messages to the channel

3rd the messages is visible on subscribed redis-cli in human readable way

4th the message is visible on the telnet screen in redis protocol way

psubscribe

subscribe to pattern

publish the message

Receive the message via pattern

Leave a Comment