Using Redis as a message queue
In addition to being a super-fast data store, Redis also does message queuing! We just spent the previous chapter covering message queues, so we don't have to cover the reason as to why we should use them. We will only cover how Redis uses them.
Redis's message queuing is much simpler than RabbitMQ. RabbitMQ has many different types of exchanges, queues, protocols, and many other features that Redis does not try to match. Redis is super simple message sending. The method we are using here is publish/subscribe. Redis can also do simple message queuing like RabbitMQ, using RPOPLPUSH. Redis Pub/Sub broadcasts published messages with anyone that is currently subscribed. It does not actually queue the messages. This is ...
Get Building Scalable Apps with Redis and Node.js now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.