Execute a workflow multi times with the same workflowID

I try to execute a workflow multiple times with the same workflowID and different input, and in this for loop, I am not calling the ‘Get’ method to get the result. But I find all runids are same, and I can only get one of the workflow execution results, other workflows does not execute when I check workflow list by tctl. Why this happen? and how to deal with it?

1 Like

Hello @haojie

You can not have more than one workflow execution running with the same workflowID (in the same namespace). I guess that this is what is happening. When you start the second execution the first has not finished yet.

Why do you need then to have the same workflowId?

You can use search attributes if you need to search your workflows
Go StartWorkflowOptions reference | Temporal Documentation, note that you need to have advanced visibility enabled to use search attributes Visibility | Temporal Documentation

Thanks, @antonio.perez
you mentioned that it can not execute one workflow multi times with the same workflowID in the same namespace, but I learned that the Workflow ld Reuse Policy can be configured as ‘Allow Duplicate’ from the temporal ducumentation. If can not execute multi times, what is meaning of the reuse policy.

I have not the scenes to be used, but I really curious about the execution result and behaviors of the temporal.

Hi @haojie

WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE is the default behavior, the term “Allow duplicate” can be a bit confusing, it allows you to reuse the workflowId when there is no other workflow running with the same workflowId.

please see enums package - go.temporal.io/api/enums/v1 - Go Packages

1 Like

Hi @antonio.perez
I misunderstood the concept of reuse policy. Thanks a lot for answer my question.