Activity-specific options and parameters

Hi,
I am just getting started with Temporal and I am interested in deploying Temporal in a containerized environment, like Kubernetes. I have a few general questions at the outset, which I could not answer by looking at the docs so far.

My mental model is that a general deployment may have a number of worker processes, each of which may contain multiple worker entities. Each worker entity is listening on one task queue, but the same task queue may be listened by multiple workers, in which case all those workers must have identical activities/workflows.

  1. Say workflow W has activities A and B. The workflow invokes each activity with specific activity options: ctx = workflow.WithActivityOptions(ctx, options) where options include retry policies and various timeouts. Instead of hardcoding the options, I’d like to pass them to the workflow in some form: one set of options for each activity, for each invocation for the workflow. To make this concrete, let’s say this could be a YAML document:
activity-1:
   retryPolicy:
       initialInterval: 1
       . . .
   timeouts:
      startToClose: ...
activity-2:
   ...

We want to pass this somehow from the workflow client, something like:
wfclient.ExecuteWorkflow(ctx, workflowOptions, myWorkflow, myParam)

How do I pass the activity options for each activity of the workflow from the workflow client?

  1. Along the same lines, I want to pass a different set of app-specific parameters to each activity in each workflow invocation. IOW, in every call in a workflow like workflow.ExecuteActivity(ctx, myActivity1, myParam), the myParam may be different and that should be specified in the workflow client. How do we do that?

Thanks in advance.

Regards,
Sundar

For 1, you can pass the markup as workflow input and build activity options from it, then call
ctx = workflow.WithActivityOptions(ctx, myOptionsFromYamlForActivityX)
before you execute activity X (similar for each activity you need to invoke).

For 2, this can be driven by your markup as well, you can build them from instructions in yaml passed as workflow input and pass them as args in your
workflow.ExecuteActivity calls.

Take a look at the Go SDK dsl sample to get some ideas.

Thank you. I’ve tried it and it works. Sorry for the delayed response.