microset
microset

Reputation: 398

how to get azure durable Functions activity status inside the Orchestrator function?

I have below code For Orchestrator Function run.ps1

param($Context)
$output = @()
$input="test"
$output1 = Invoke-DurableActivity -FunctionName 'storage_account' -Input $input -nowait
Wait-ActivityFunction -Task $output1
$output1

function.json

{
  "bindings": [
    {
      "name": "Context",
      "type": "orchestrationTrigger",
      "direction": "in"
    }
  ]
}

Activity Trigger -- storage_account function.json

 {
      "bindings": [
        {
          "name": "name",
          "type": "activityTrigger",
          "direction": "in"
        }
      ]
    }

run.ps1

param($name)
$rg="test"
$location="westus"
$checkname = (Get-AzStorageAccountNameAvailability $name).NameAvailable

If($checkname -eq "False"){
$name= $name + "date"+(get-date -Format MMdd)+"time"+(get-date -Format hhmm)
}
 "Storage Account $name :inprogress"
$accountstatus = New-AzStorageAccount -Name $name -ResourceGroupName $rg -SkuName Standard_LRS -Location $location 
IF(($accountstatus.ProvisioningState) -eq 'Succeeded'){
    "Storage Account $name :Created"
}

Is there any ways to get durable Functions activity status inside the statusQueryGetUri or inside the Orchestrator ? Currently result will be getting after all completed but I need the result for every activity like creating or created. I can set single status using

Update: I can get single status using (docs:https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-custom-orchestration-status?tabs=powershell#querying-custom-status-with-http Set-DurableCustomStatus) there is only single status can be store , If I use customstatus 2 times then 2nd one (or last one show on output) will be show in output & 1st one will be disappear. but I'm looking for the status like

{
  "customStatus": ["Completed", "Completed", "Started", "Started", "Completed"]
}

docs:https://joonasw.net/view/track-activity-and-sub-orchestrator-progress-in-azure-durable-functions-orchestrators

multiple status achieved by C# but I cannot see any docs for multiple custom status cannot be set by powershell.

Upvotes: 0

Views: 1345

Answers (1)

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4776

how to get azure durable Functions activity status inside the Orchestrator function?

Is there any ways to get durable Functions activity status inside the statusQueryGetUri or inside the Orchestrator?

statusQueryGetUri requires the Http Endpoint of the Functions activity class which also requires the system key as admin endpoint. Because status endpoint URL contains the same value as the statusQueryGetUri field.

Even the custom status can be set using PowerShell code to durable activity functions, the status can be queried using the HTTP GET API Request.

Refer to Marc’s Answer on getting the activity function status using the Http Endpoints and also Azure Functions Core Tools Cmdlet.

Upvotes: 0

Related Questions