What is the difference between redis message queuing and publish / subscribe system? How do you choose?

what is the difference between the blocking message queue
implemented with jedis"s BRPOP and BLPOP and the
publish / subscribe system implemented using jedis"s subscribe and publish
, and how to choose?


when the message queue is blocked by BRPOP and BLPOP, the message queue will be disconnected automatically when you get the data. If you want to obtain the data continuously, you need to add your own listener during program design, while this will not happen with subscribe and publish. The subscriber itself will listen to the sender all the time.


BRPOP is for a scenario where a message has only one consumer. Queue
subscribe similar to AMQ is for a scenario where a message has multiple consumers, similar to AMQ's topic


an one-to-one consumption list
an one-to-many consumption subscription

Menu