Tracking Process Status in Temporal Workflows

We want to track the status of a process. There are options to find process information using workflowId and runId. (*When we refer to a “process,” we specifically mean a Workflow Execution in the Temporal system.)

Option with workflowId:

Our workflowId follows the format {clientId}-{action(activate, deactivate, change)}-{option(value1, value2)} (example: client1-activate-value1) However, a problem arises because workflowId only stores information about the latest process with the same workflowId.
To explain: If we sequentially run processes with these workflowIds:
client1-activate-value1
client1-deactivate-value2
client1-activate-value1 The information about the first process is lost.

Option with runId:

Here, each process execution creates a new runId, which can be used to track a specific process and information is not lost. However, a problem occurs: during retry, the process is assigned a new runId, so we need some way to keep the runId updated. Proposed solution: store a database table with processId and runId fields and update the runId when a process is retried. But can we set custom logic in retry and how would we implement this?

What do you think? What’s the best way to solve this issue?

Why not create only one workflow (with one run per client) and use signals to trigger actions?

You’ll have to manage the continue-as-new if you perform a lot of actions over time.

You’ll be able to use queries to get business-specific info on the workflow.