How to access or consume Tags inside orchestration or activity in Durable Task Framework (DTFx)?

14 hours ago 1
ARTICLE AD BOX

I am working with Durable Task Framework (DTFx) using the SQL provider, and I am passing metadata using the tags parameter while starting an orchestration:

var tags = new Dictionary<string, string> { ["CorrelationId"] = correlationId }; await taskHubClient.CreateOrchestrationInstanceAsync( "QuoteReferralOrchestration", "V1", instanceId, input, tags );

Question:

How can I access or consume these Tags inside:

Orchestration (TaskOrchestration)

Activity (TaskActivity)

From my testing:

Tags are stored in the underlying SQL store (OrchestrationInstances table)

They are accessible via:

await orchestrationService.GetOrchestrationStateAsync(instanceId, null);

They are not available in OrchestrationContext Accessing them via SqlOrchestrationService inside orchestration is not recommended (non-deterministic)

Since orchestrations must be deterministic:

We cannot safely query the DB from inside orchestrator There is no built-in API like: Is there any supported way to access tags inside orchestration or activity? Are tags intended only for external querying / monitoring? What is the recommended pattern for passing correlation data into orchestration logic?

Context

We are trying to use tags for:

Correlation tracking Logging Workflow tracing across services
Read Entire Article