Support dynamic activity and workflow implementations
Is your feature request related to a problem? Please describe. In some cases, activity and workflow implementations should be loaded dynamically.
Describe the solution you'd like Expose an extension point for dynamic activity loading. This issue is created to ensure feature parity among SDK's where https://github.com/temporalio/sdk-java/issues/245 already implements this for Java.
Additional context In Dynamic activities registration at runtime and worker splitting on the community forum @mfateev requested another user to create this issue, but that never happened AFAIK. Hence this issue.
Hi, is there some progress?
We have not prioritized this because there haven't been many requests. Are you needing dynamic activity/workflow support? In almost all cases, a properly named/registered activity/workflow should be used and field in the parameter can be provided to take different paths. Can you describe your use case (here or in Slack or in forum)?
@cretz can you share an example of what you describe ?
Something like:
func FallthroughWorkflow(ctx workflow.Context) error {
workflow.GetLogger(ctx).Info("Called workflow: " + workflow.GetInfo(ctx).WorkflowType.Name)
}
func FallthroughActivity(ctx context.Context) error {
activity.GetLogger(ctx).Info("Called activity: " + activity.GetInfo(ctx).ActivityType.Name)
}
func Register(worker worker.Worker) error {
worker.RegisterWorkflowWithOptions(FallthroughWorkflow, workflow.RegisterOptions{Dynamic: true})
worker.RegisterActivityWithOptions(FallthroughActivity, activity.RegisterOptions{Dynamic: true})
}
So basically that workflow or activity is called when one for the specific name is not found.
Hi,
We are also looking at support for dynamic activity registration for Go. Would be great if you can provide some ETA?
Thanks, Jay.
I think we need to do the workflow.RegisterOptions{Dynamic: true}/activity.RegisterOptions{Dynamic: true} and we need to require that the function signature accept a string name and a slice of converter.EncodedValue values.