第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從 Azure Function 中出列 Azure 存儲隊列

從 Azure Function 中出列 Azure 存儲隊列

PHP
有只小跳蛙 2024-01-20 21:31:15
我一直在尋找示例來輕松地使 Azure 存儲隊列出隊,就像將項目入隊一樣(通過在 Run 方法中注入 IAsyncCollector)。但遺憾的是,沒有成功。我發(fā)現(xiàn)的唯一的事情就是將項目排隊或?qū)μ砑拥疥犃兄械捻椖孔龀龇磻?yīng)。我的本地服務(wù)器上運行一個應(yīng)用程序,它將定期調(diào)用該函數(shù)(并不斷調(diào)用直到隊列為空)以獲取隊列的項目。我想使用 Azure 函數(shù)來執(zhí)行此操作。歡迎任何幫助。
查看完整描述

2 回答

?
拉風(fēng)的咖菲貓

TA貢獻1995條經(jīng)驗 獲得超2個贊

如下:

ICollector 和 IAsyncCollector 可用作存儲隊列輸出綁定的參數(shù)類型。

目前,azure 函數(shù)綁定僅支持輸出綁定以將消息寫入隊列?;蛘?,如果您不需要使用 HTTP 請求調(diào)用隊列觸發(fā)器,則可以使用隊列觸發(fā)器來檢索消息。

如果您必須使用 HTTP 請求,假設(shè)您必須創(chuàng)建一個 HTTP 觸發(fā)函數(shù),然后檢索并刪除隊列以實現(xiàn)出隊操作,如下面的代碼。

public static async Task<IActionResult> Run(

? ? ? ? [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,

? ? ? ? ILogger log)

? ? {

? ? ? ? log.LogInformation("C# HTTP trigger function processed a request.");


? ? ? ? // Parse the connection string and return a reference to the storage account.

? ? ? ? CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("AzureWebJobsStorage"));

? ? ? ? CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();


? ? ? ? // Retrieve a reference to a queue

? ? ? ? CloudQueue queue = queueClient.GetQueueReference("myqueue");


? ? ? ? // Async dequeue the message

? ? ? ? CloudQueueMessage retrievedMessage = await queue.GetMessageAsync();

? ? ? ? Console.WriteLine("Retrieved message with content '{0}'", retrievedMessage.AsString);


? ? ? ? //Process the message in less than 30 seconds, and then delete the message

? ? ? ? await queue.DeleteMessageAsync(retrievedMessage);


? ? ? ? return? (ActionResult)new OkObjectResult(retrievedMessage.AsString);


? ? }

https://img1.sycdn.imooc.com/65abcb63000198b005780628.jpg

查看完整回答
反對 回復(fù) 2024-01-20
?
SMILET

TA貢獻1796條經(jīng)驗 獲得超4個贊

為什么不創(chuàng)建一個應(yīng)用程序調(diào)用的 Webhook 函數(shù),然后在該函數(shù)中,您可以根據(jù)需要使用適用于您使用的任何語言的標準存儲隊列 API 將項目出列。



查看完整回答
反對 回復(fù) 2024-01-20
  • 2 回答
  • 0 關(guān)注
  • 233 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號