1:queue
1)、QueueDeclare 聲明隊列
QueueDeclareOk QueueDeclare(string queue, bool durable, bool exclusive, bool autoDelete, IDictionary<string, object> arguments);
durable:持久化
mnesia:數據庫【有專門的表去保存我們的隊列聲明】
exclusive:排外
i:當前定義的隊列是connection中的chanenl是共享的,其他的connection是訪問不到的;
ii:當connection.close時,queue就被刪除。
autoDelete:自動刪除:當最后一個consumer斷開之后,autodelete被觸發;
arguments:參數【功能強大】,rabbitmq的一個擴展
2)、QueueBindNoWait 隊列聲明無需等待【async】異步流程
3)、QueueDeclarePassive 消極的隊列聲明
this.QueueDeclare(queue,true,false,false,false,null);
only check if it exists
如果隊列不存在拋出異常
如果隊列存在不做任何操作
4)、queue的arguments
i)我們要知道的參數屬性
《1》、Message TTL
queue TTL 限制隊列中所有message限定一個時間
x-message-ttl number類型
Message TTL 單獨指定message限定一個時間
var properties=channel.CreateBasicProperties();
properties.Exporation="8000";
如果兩個都設定,則按照時間短的觸發。
《2》、Auto Expire【自動刪除】
當queue在指定的時間未被訪問 ,就會被刪除
consumer、basicget、declare。。。
《3》、Max Length限定隊列的最大長度 limit 100
《4》、Max Length Bytes限定隊列的最大占用空間大小 【一般來說受限於內存,disk的大小限定】