1

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

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

4

1 回答 1

3

您可以(在将 DurableFunctions 添加到您的函数应用程序之后)通过一个附加参数扩展您的 blob 触发函数的签名,[OrchestrationClient] DurableOrchestrationClient orchestrationClient这使您能够启动新的编排。

[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/它显示了有关如何执行此操作的更多详细信息.

于 2018-12-17T07:47:00.360 回答