当前位置:网站首页>redis delay queue
redis delay queue
2022-08-02 14:21:00 【Spaghetti Mixed with No. 42 Concrete】
redis delay queue
Introduction
We are usually used to using Rabbitmq
and Kafka
as message queue middleware to add asynchronous messaging between applications.Both of these middleware are professional message queue middleware with more features than most people can understand.
Students who have used Rabbitmq
know how complicated it is to use. Before sending a message, you need to create a Exchange
, and then create a Queue
.Bind Queue
and Exchange
through a certain rule, specify routingkey
when sending a message, and control the header information.Consumers also need to go through the above series of cumbersome processes before consuming messages.But in most cases, although our message queue has only one set of consumers, it still needs to go through the above tedious processes.
With Redis, it can free us. For those message queues with only one set of consumers, Redis can be used very easily.The message queue of Redis is not a professional message queue. It does not have many advanced features, and there is no ack guarantee. If you have the ultimate pursuit of message reliability, then it is not suitable for use.
Asynchronous message queue
Redis's list (list) data structure is often used as an asynchronous message queue, using rpush/lpush operations to enter the queue, and use lpop and rpop to exit the queue.
127.0.0.1:6379> lpush notfily-queue apple banana pear(integer) 3127.0.0.1:6379>llen notfily-queue(integer) 3127.0.0.1:6379>lpop notfily-queue"apple"127.0.0.1:6379>llen notfily-queue(integer) 2127.0.0.1:6379>lpop notfily-queue"pear"127.0.0.1:6379>lpop notfily-queue"banana"127.0.0.1:6379>lpop notfily-queue(nil)127.0.0.1:6379>llen notfily-queue(integer) 0
边栏推荐
- Flask framework in-depth
- xshell连接虚拟机步骤_建立主机与vm虚拟机的网络连接
- run yolov5
- Hands-on OCR (1)
- Sentinel源码(四)(滑动窗口流量统计)
- The most complete ever!A collection of 47 common terms of "digital transformation", read it in seconds~
- chapter7
- 第八单元 中间件
- PHP open source customer service system _ online customer service source code PHP
- 使用云GPU+pycharm训练模型实现后台跑程序、自动保存训练结果、服务器自动关机
猜你喜欢
随机推荐
Flask请求应用上下文源码分析
MySQL数据库语法格式
Flask framework in-depth
第十三单元 混入视图基类
如何自定义feign方法级别的超时时间
[ROS] The software package of the industrial computer does not compile
Shell脚本完成pxe装机配置
replay视频播放器_怎么让手机音乐跟视频一起放
yolov5 improvement (1) Add attention focus mechanism
跑跑yolov5吧
redis分布式锁和看门狗的实现
第十一单元 序列化器
window10下半自动标注
How does Apache, the world's largest open source foundation, work?
Flask项目的完整创建 七牛云与容联云
drf序列化器-Serializer
动态刷新日志级别
关于密码加密的一点思路
What's wrong with running yolov5 (1) p, r, map are all 0
[ROS] Compiling packages packages encounters slow progress or stuck, use swap