在 Azure Durable Function 更改状态时获取事件 持久函数 2.x

问题描述

我想监控 Azure Durable Orchestrator Function 的运行实例是否有变化(例如它何时完成、失败等)

我知道我可以轮询状态 API 以了解更改,但我想知道是否有任何基于推送的功能。我已经查看了源代码,但似乎找不到任何有关支持此功能的扩展点、接口等的线索。

关于如何实现这一目标的任何想法?

谢谢!

解决方法

目前,发布编排生命周期事件(例如创建、完成和失败)仅限于自定义 Azure Event Grid Topic。此功能目前处于预览状态。参考Durable Functions publishing to Azure Event Grid (preview)

持久函数 2.x

notifications 部分添加到文件的 durableTask 属性,将 <topic_name> 替换为您选择的名称。如果 durableTaskextensions 属性不存在,请像以下示例一样创建它们:

{
  "version": "2.0","extensions": {
    "durableTask": {
      "notifications": {
        "eventGrid": {
          "topicEndpoint": "https://<topic_name>.westus2-1.eventgrid.azure.net/api/events","keySettingName": "EventGridKey"
        }
      }
    }
  }
}

事件架构

以下列表解释了生命周期事件架构:

  • id:事件网格事件的唯一标识符。
  • subject:事件主题的路径。 durable/orchestrator/{orchestrationRuntimeStatus}{orchestrationRuntimeStatus} 将是 RunningCompletedFailedTerminated
  • data:持久函数特定参数。
    • hubNameTaskHub 名称。
    • functionName:Orchestrator 函数名称。
    • instanceId:Durable Functions instanceId。
    • reason:与跟踪事件相关的附加数据。有关详细信息,请参阅 Diagnostics in Durable Functions (Azure Functions)
    • runtimeStatus:编排运行时状态。正在运行、已完成、失败、取消。
  • eventType: "orchestratorEvent"
  • eventTime:事件时间 (UTC)。
  • dataVersion:生命周期事件架构的版本。
  • metadataVersion:元数据的版本。
  • topic:事件网格主题资源。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...