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

标签 azure azure-functions azure-durable-functions timer-trigger

我已经实现了一个 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/

相关文章:

c# - Azure Durable Functions 中的最大事件响应数据大小限制

mongodb - 通过代码在 Cosmos DB 中启用 Mongo DB 聚合管道

Azure 持久功能 : 403 and 409 errors when writing internally to blob/queue/table. 我需要 "Storage Account Contributor"吗?

azure - 了解耐用功能的实际好处

azure - 为什么 Azure Functions 不使用应用服务计划中的其他实例来处理数据?

c# - 有没有办法将 Azure Functions 主机记录器附加到普通的 C# 跟踪?

c# - 是否可以从 .net core 查询表存储?

powershell - 在 powershell 工作流程中使用 AzureStorageContext

python - 如何在 Python 中生成 Azure Blob 存储 SAS token 的签名?

c# - Azure 发布 :a runtime component is missing:/base/x64/IISConfigurator. exe