temporalio / features

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

[Feature Request] Provide client from an activity #203

Open lorensr opened 1 year ago

lorensr commented 1 year ago

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

In order to get a Client in an Activity, you have to import & create one.

Describe the solution you'd like

Add a Client instance to Context

https://typescript.temporal.io/api/classes/activity.Context

so that users can do

Context.current().client.workflow.signalWithStart

Additional context

Similar to this Go sample:

https://github.com/temporalio/samples-go/blob/e7f07468217806f57b22205692c4d70608b3e68b/mutex/mutex_workflow.go#L138

cretz commented 1 year ago

You're linking a Go sample to justify an included-in-SDK feature. Go does not offer the client at https://pkg.go.dev/go.temporal.io/sdk/activity. I think if we want to offer activities the Temporal client for use, we should do this for every SDK instead of just an issue in TS repo.

cretz commented 1 year ago

Thanks!