temporalio / features

Behavior and history compatibility testing for Temporal SDKs
13 stars 16 forks source link

[Feature Request] Expose schedule specific info in Workflows through a API #243

Open Quinn-With-Two-Ns opened 1 year ago

Quinn-With-Two-Ns commented 1 year ago

Is your feature request related to a problem? Please describe.

When a workflow is started by a schedule some extra information is written to search attributes

Currently the only way to access this info is through search attributes, this is difficult for users to discover and work with in some SDKs

Describe the solution you'd like

A separate API to return this information if the workflow was started by a schedule.

Additional context

(https://temporalio.slack.com/archives/CTDTU3J4T/p1678200766095479)

dreamworld commented 3 weeks ago

I also run into this problem, one possible way is to use the deprecated GetInfo api

var startTime time.Time
p := workflow.GetInfo(ctx).SearchAttributes.GetIndexedFields()["TemporalScheduledStartTime"]
err := converter.GetDefaultDataConverter().FromPayload(p, &startTime)

ref

The new typed api workflow.GetTypedSearchAttributes(ctx).GetTime() requires internal.SearchAttributeKeyTime, which cannot be referenced inside workflow

cretz commented 2 weeks ago

requires internal.SearchAttributeKeyTime, which cannot be referenced inside workflow

This is available on the temporal package: https://pkg.go.dev/go.temporal.io/sdk/temporal#SearchAttributeKeyTime