Azure Strage中的Queue機制
Storage Queue是相對Service Bus而言較為簡單便宜的queue解決方案,以Storage為儲存體,在Storage中就可以直接建立: 透過程式碼操作的方式也很簡單,先找到key: 接著透過SDK,建立一個QueueClient物件即可操作: public static void CreateQueueClient ( string queueName ) { // Get the connection string from app settings string connectionString = ConfigurationManager . AppSettings [ "StorageConnectionString" ] ; // Instantiate a QueueClient which will be used to create and manipulate the queue QueueClient queueClient = new QueueClient ( connectionString , queueName ) ; } 請注意上面的程式碼使用了 Azure.Storage.Queues 套件,因此你必須從nuget安裝: dotnet add package Azure.Storage.Queues 我在github上有一個範例,讀者可以在建立好queue之後,透過git clone下載該範例運行: git clone https://github.com/isdaviddong/az204-DemoAzureStorageQueue.git 運行的流程請看底下展示影片: 身為一個簡簡單單的FIFO容器,Queue看起來沒啥大錄用,不過就是放放資料讓資料排隊慢慢處理,但記得前面提過的 Load Leveling嗎: (from Microsoft architecture center) 如果用的好,Queue可以幫你省下大筆 做 scale out的經費呢,總有人覺得雲端貴,但其實,往往...