Casper Jensen
Casper Jensen

Reputation: 581

Get events when an Azure Durable Function changes status

I want to monitor a running instance of an Azure Durable Orchestrator Function for changes (like when it completes, fails etc)

I know that I can poll the status API for changes, but i was wondering if there were any push-based functionality. I've looked into the source code but I can't seem to find any clues to extension points, interfaces etc that enables this.

Any ideas on how to achieve this?

Thanks!

Upvotes: 3

Views: 573

Answers (1)

krishg
krishg

Reputation: 6508

Right now, publishing orchestration lifecycle events (such as created, completed, and failed) is limited to a custom Azure Event Grid Topic. This feature is currently in preview. Refer Durable Functions publishing to Azure Event Grid (preview).

Durable Functions 2.x

Add a notifications section to the durableTask property of the file, replacing <topic_name> with the name you chose. If the durableTask or extensions properties don't exist, create them like this example:

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

Event Schema

The following list explains the lifecycle events schema:

  • id: Unique identifier for the Event Grid event.
  • subject: Path to the event subject. durable/orchestrator/{orchestrationRuntimeStatus}. {orchestrationRuntimeStatus} will be Running, Completed, Failed, and Terminated.
  • data: Durable Functions Specific Parameters.
    • hubName: TaskHub name.
    • functionName: Orchestrator function name.
    • instanceId: Durable Functions instanceId.
    • reason: Additional data associated with the tracking event. For more information, see Diagnostics in Durable Functions (Azure Functions)
    • runtimeStatus: Orchestration Runtime Status. Running, Completed, Failed, Canceled.
  • eventType: "orchestratorEvent"
  • eventTime: Event time (UTC).
  • dataVersion: Version of the lifecycle event schema.
  • metadataVersion: Version of the metadata.
  • topic: Event grid topic resource.

Upvotes: 1

Related Questions