【发布时间】:2018-12-14 17:53:59
【问题描述】:
我需要关于使用 blob 触发器编写持久函数的帮助,任何人都可以帮助解决这个问题。
我已经创建了一个 Blob 触发器函数,它将处理任何进入 blob 的新文件,现在我需要将 blob 触发器函数迁移到持久函数,我没有看到持久函数中 blob 触发器的任何选项可以任何一个指导我?
【问题讨论】:
标签: azure-functions azure-durable-functions
我需要关于使用 blob 触发器编写持久函数的帮助,任何人都可以帮助解决这个问题。
我已经创建了一个 Blob 触发器函数,它将处理任何进入 blob 的新文件,现在我需要将 blob 触发器函数迁移到持久函数,我没有看到持久函数中 blob 触发器的任何选项可以任何一个指导我?
【问题讨论】:
标签: azure-functions azure-durable-functions
您可以(在将 DurableFunctions 添加到您的函数应用之后)通过附加参数 [OrchestrationClient] DurableOrchestrationClient orchestrationClient 扩展您的 blob 触发函数的签名,这使您能够启动新的编排。
[FunctionName("TriggeredByBlob")]
public static async void Run([BlobTrigger("container/{blobName}", Connection = "Blob:StorageConnection")]Stream requestBlob, string blobName, [OrchestrationClient] DurableOrchestrationClient orchestrationClient)
{
// ... you code goes here
string instanceId = await orchestrationClient.StartNewAsync("OrchestrationThatProccesesBlob", blobName);
// ... you code goes here
}
这里有一个来自 Paco de la Cruz 的示例https://pacodelacruzag.wordpress.com/2018/04/17/azure-durable-functions-approval-workflow-with-sendgrid/,其中显示了有关如何执行此操作的更多详细信息。
【讨论】: