Is it possible to get workflow info from within an activity?

Within an activity function body, is it possible to get a Workflow.Info, without passing a Workflow.Info object as an input to every activity function that needs it? workflow.GetInfo(ctx) accepts a workflow.Context but activity functions can access context.Context only

activity.GetInfo

@maxim, thanks for your reply! However, activity.GetInfo returns a activity.Info which is missing workflow level info, such as search attribute and memo

These do not make sense in the context of an activity that is expected to have a well-defined API. In this design, attribute and memo would be more like global variables. Pass all the information an activity needs to execute as its input.

My use case is, inside an activityInboundInterceptor, I look up a search attribute of the running workflow and perform different actions based on the values. Since activityInboundInterceptor intercepts all activities, and activityInboundInterceptor.ExecuteActivity(context.Context, *interceptor.ExecuteActivityInput) only exposes a generic input object, it would be error prone if we expect every activity function to contain a certain input argument. Anyway, thanks for confirming that this is not possible.

It is possible, but you’ll need to add this data to the header using workflow outbound interceptor.