rabbitmq 3 entities之 queue

本文介绍了AMQP中队列(queue)的管理与配置细节,包括队列的各种属性如durable、exclusive等的作用,以及队列如何被声明和使用的规则。还讨论了队列持久性对消息的影响。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

queue attributes:类似exchange的属性

name:队列的名字

durable:为true时,broker重新还在

exclusive:为某一个connection所独有的,当此connection 关闭的时候,queue也会被删掉

auto-delete:当没有consumer 订阅到此queue时,此queue会被删掉

arguments:为plugin和broker specific feature使用,用于扩展


queue使用前需先定义,如果定义的queue不存在,则直接创建,如果存在,并且所有的attributes相同,则用原有的,如果有参数不同,则报错406 precondition-failed.

queue name: 255 bytes, UTF-8格式,可以用户指定,也可以让broker帮忙自动生成,只需要定义queue的那么为空字符,通过return 对象能取到生成的queue name

注意,以amq.开头的queue name是broker内部保留的,如果违反会导致channel-level exception with reply code 403 accessed-refused。

queue durability:为true是,保存到disk,否则是transient的,重启broker就消失

Durability of a queue does not make messages thatare routed to that queue durable. If broker is taken downand then brought back up, durable queue will be re-declaredduring broker startup, however, only persistentmessages will be recovered.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值