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.