Publish and subscribe mechanism
When a client sends a message to the subscriber via the PUBLISH command, we call the client Publisher.
When a client uses the SUBSCRIBE or Psubscribe command to receive information, we call the client a Subscriber (subscriber).
To understand the relationship between a decoupling publisher (publisher) and a Subscriber (subscriber), Redis uses the channel (channel) as an intermediary--the publisher publishes the information directly to channel, and the channel is responsible for sending the information to the appropriate subscriber, There is no relationship between the publisher and the Subscriber, and there is no knowledge of the other.
The following figure is suitable for batch management, each client's server must have a redis-cli, install Redis naturally have, and then define sub, in the management end can be published through pub Some instructions, the client received, you can perform, you can do some other operations.
Some of the more practical examples:
Crawling Information clusters:
Http://www.starming.com/index.php?action=plugin&v=wave&tpl=t&nav=76&pg=1&gid=73&tid= 20964
Online chat Room:
Https://github.com/lzyy/chat
Monitoring and processing of the server:
Http://tech.ddvip.com/2013-05/1368026505195115.html
This article is from the "Technology Achievement Dream" blog, please be sure to keep this source http://weipengfei.blog.51cto.com/1511707/1215417