dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

User metadata not propagated from child workflow command to child workflow's execution config #9

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

Expected Behavior

Like start workflow, I would expect start child workflow user metadata to end up on the execution config on the child workflow.

Actual Behavior

The user metadata only ends up on the event, not the actual child workflow

See https://github.com/temporalio/temporal/pull/5857 where user metadata propagation was added.

dhiaayachi commented 1 month ago

Thanks for reporting this!

This is a known issue. It was reported in https://github.com/temporalio/temporal/pull/5857

You can use GetInfo to access the user metadata.

dhiaayachi commented 1 month ago

Thanks for reporting this. User metadata only ends up on the event, not the actual child workflow. To set user metadata for a child workflow, you can use the StartChildWorkflowOptions object.

Here is an example of how to do it in the Go SDK:

childWorkflowOptions := workflow.ChildWorkflowOptions{
   // ...
   UserMetadata: map[string]string{
     "key": "value",
     "key2": "value2",
   },
}
ctx = workflow.WithChildOptions(ctx, childWorkflowOptions)

childWorkflowFuture := workflow.ExecuteChildWorkflow(ctx, YourOtherWorkflowDefinition, ChildParams{})
// ...

For other SDKs, refer to the documentation for setting user metadata on StartChildWorkflowOptions.