How to customize workflow type name?

Hi Folks

We’ve a use-case where we might create workflows from DDL. AFAIK, workflowTypes are named after the main method for that workflow. Given our DDL use-case, we would like to change the type to a customized name. Is it possible?
We would like to query workflows and thinking of using this customized type name for filtering, hence the need for customized name.

Thanks in advance for your support.

Use worker.RegisterWorkflowWithOptions:

	w.RegisterWorkflowWithOptions(
                 <workflowFn>, workflow.RegisterOptions{Name: <name>})
1 Like

Any plans to do similar thing in Java SDK? I was curious about that too and it looks like that in Java it is only possible to set WF name by using ‘name’ attribute on @WorkflowMethod, so it is static.


…temporal-sdk-1.0.3-sources.jar!/io/temporal/internal/sync/POJOWorkflowMethodMetadata.java:44

What would be the semantic of calling such workflow in case of Java? Should we pass the workflow type name into Workflow.newChildWorkflowStub call as an option?

Not sure, just thinking in terms of parity among SDKs, and this seems to me as one of ways change propagation can happen - one is to register WF with different queues, another is to manipulate WF name, I have use case that seems to call for a dynamic WF that internally maintains an FSM (Final State Machine), there would be some variations of FSM-s at the time of workflow initiation, and manipulating name seems like a way to make that visible. Again, I might be wrong and there are better ways to do it. Just thoughts.

This is an interesting topic. Longer term we plan to provide direct support for workflows that implement DSL support. The basic idea would be that the workflow worker would be registered as a special DSL workflow and each DSL document instance would be treated as a separate workflow type automatically.

Hi, Do we have workflow type name customization available for Java SDK now?

Do you have any plans to create something similar to this in the python SDK? We have a generic workflow deployed in different workers with a different set of activities. Right now, we route to one version or another one based on the queue name and that is working but in the UI we see the name of the generic worklow and that is not very useful as we have some high level workflows calling different implementations of the generic one and it is difficult to see this in the UI.

Being able to specify different names for the workflow at deployment time (but these are predictable, so we do not need to go all the way there to dynamic workflows) would solve the UI problem. It might also enable us to be more flexible with the queue allocation if we can use the new name to invoke the workflow, but I guess that will depend on how the feature is implemented.

Thanks!

The @workflow.defn decorator can be provided a name if you want to deviate from the default (which is unqualified class name)

But that only allows one name per class, and you cannot change it in a sensible way without modifying the code. I would to be able to define the name when I am configuring the worker as I want to have different names for the same class in different workers.

BTW the Temporal Java SDK supports DynamicWorkflow and DynamicActivity that solve this problem holistically.