持久函数 Blob 触发器

Durable Function Blob Trigger

我需要有关使用 blob 触发器编写持久函数的帮助,任何人都可以提供帮助。

我已经创建了一个 Blob 触发器函数,它将处理任何进入 blob 的新文件,现在我需要将 blob 触发器函数迁移到持久函数,但我在持久函数中看不到 blob 触发器的任何选项任何人都可以指导我吗?

您可以(在将 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/,其中显示了有关如何操作的更多详细信息。