Redis 是内存数据库和消息代理。
比如我们可以在redis中创建多个数据库,
所以,像聪明人一样,
如何在redis中创建多个(消息代理/消息队列)?
最佳答案
您可以通过拥有多个列表来创建多个队列:
Pattern: Reliable queue Redis is often used as a messaging server to implement processing of background jobs or other kinds of messaging tasks. A simple form of queue is often obtained pushing values into a list in the producer side, and waiting for this values in the consumer side using RPOP (using polling), or BRPOP if the client is better served by a blocking operation. However in this context the obtained queue is not reliable as messages can be lost, for example in the case there is a network problem or if the consumer crashes just after the message is received but it is still to process. RPOPLPUSH (or BRPOPLPUSH for the blocking variant) offers a way to avoid this problem: the consumer fetches the message and at the same time pushes it into a processing list. It will use the LREM command in order to remove the message from the processing list once the message has been processed. An additional client may monitor the processing list for items that remain there for too much time, and will push those timed out items into the queue again if needed.
关于:
how to create multiple (message broker/message queues) in redis?
每个列表都是一个不同的队列。你可以有多个发送者和接收者的地方。 关于经纪人:那就是 Redis。 它还支持 pub/sub .
关于雷迪斯 : how to create multiple redis queue/message broker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37098149/