1) What is Publish-Subscribe (pub-sub)?
publish-subscribe(pub-sub) is a messaging pattern where senders of messages, called publishers, do not send the message directly to the receivers, called subscribers, but not instead categorize publishes messages into classes without knowledge of which subscribers.
2) Implementation
- On 2 separate clients, subscribe to a key using "SUBSCRIBE <key> <..key(s)>
- On a third client, use the key used in step 1 and enter "PUBLISH <key above> <message>"
- You should then see the message show up in the two redis clients that subscribed to the key.
3) Unsubscribe
The opposite of subscribing.
4) Pattern matching pub/unsub
Use "PSUBSCRIBE <regex>" or "PUNSUBSCRIBE <regex>"
Resource
Comments
Post a Comment