python - 设置队列中的最大消息数

标签 python rabbitmq queue pika

我想知道是否可以设置队列中的最大消息数?

假设我希望队列 Foo 中的消息不超过 100 条,可以吗?

最佳答案

对的,这是可能的。

来自 official documentation

The maximum length of a queue can be limited to a set number of messages by supplying the x-max-length queue declaration argument with a non-negative integer value.



AFAIK,鼠兔 channel.queue_declare有 queue_declare 有 arguments论证这绝对是你想要的。

关于python - 设置队列中的最大消息数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17655559/

相关文章:

python - 接收流时中断python grpc客户端

c++ - 使用 Python C API 实现 PyMyType_Check 方法?

python - Timsort 的合并模式

python - 为python脚本错误创建.exe

rabbitmq-plugins 无法以rabbitmq 用户身份运行

java - 同步队列是否在每个报价/放置上创建一个线程?

python - Django 中命名空间模板的优雅方式

php - 无法读取来自 RabbitMQ 的所有消息

redis - 如果 celery worker 死得很惨,工作会重试吗?

ios - iOS 上有延迟作业的框架吗?