gpt4 book ai didi

azure - 读取定时器触发 azure 持久函数内的请求有效负载

转载 作者:行者123 更新时间:2023-12-03 07:02:54 24 4
gpt4 key购买 nike

我已经实现了一个 Azure 持久功能,可以使用计时器触发器来触发。此外,同样的 azure 耐用功能也需要手动触发。我能够按照官方文档 here 中的说明手动触发计时器触发器。 .

我的 azure 持久功能如下所示。

[FunctionName("Weekly_HttpStart")]
public static async Task HttpStart(
[TimerTrigger("0 0 10 * * 3")] TimerInfo timerInfo,
[DurableClient] IDurableOrchestrationClient starter,
ILogger log)
{
string instanceId = await starter.StartNewAsync("ProcessWeeklyBatch", null);
log.LogInformation($"Started 'ProcessWeeklyBatch' orchestration with ID = '{instanceId}'.");
}

我现在遇到的问题是,当我手动触发它时,我需要将参数传递给这个计时器来触发azure Durable函数。

根据这里的官方文档,我们可以在请求中添加body参数。 (如下图),但我没有看到任何方法可以在azure函数中读取它们。

enter image description here有没有人遇到过如何在计时器内读取请求有效负载并触发azure持久功能?

最佳答案

我不确定为什么要将某些内容传递给计时器作业,但解决方法是创建单独的函数,一个是 HTTP 触发的函数,一个是计时器触发的函数,它们只共享底层逻辑,如 example 所示。 .

关于azure - 读取定时器触发 azure 持久函数内的请求有效负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72023271/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com