![](/img/trans.png)
[英]How can I set Queue Storage message TTL in the context of an Azure Function output binding in Python?
[英]Can you rate limit an Azure Function or output of a Storage Queue?
I have a Storage Queue triggered Python Azure Function that submits a job to a third-party rate-limited API (1 request/minute). 觸發 function 的隊列會周期性地接收突發消息,所以我需要一種方法來確保 function 在收到第一條消息后立即觸發,第二條消息在 1 分鍾后觸發,第三條消息在 2 分鍾后觸發,等等,直到隊列為空。
是否可以對隊列或 function 進行速率限制,所以我每分鍾只運行一次 function 直到隊列為空?
沒有辦法對存儲隊列進行速率限制(除了隊列自然受到存儲事務速率限制的速率限制,這比您當前所需的速率限制大幾個數量級)。
Rather than trigger your Azure function off of queue message arrival, you can set up a timer trigger for your Azure function. 這將允許您在計時器上設置 1 分鍾的間隔,您的 function 可以讀取消息並調用第 3 方 API。
您需要指定一個計時器值,它是一個 NCRONTAB 表達式,格式如下:
{second} {minute} {hour} {day} {month} {day-of-week}
每 1 分鍾一次的表達式如下所示:
"0 */1 * * * *"
有關計時器觸發器的更多信息,請點擊此處。
看一下NextVisibleTime屬性:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.