Versioning with continueAsNew?

Hi all,

I have a simple question about continueAsNew. Sorry if it has been asked before.

I’m familiar with the concept of versioning so that existing workflows will continue to run the old code while newer workflows can run a newer version of the code.

I’d like to understand at what point it is safe to clean up the old versioning branch.
My application has long-running workflows, however we continueAsNew regularly to avoid hitting event/signal limits. If a workflow on Version A calls continueAsNew, will the newly continued workflow be running on Version B? Or will it remain on the Version A like the original workflow?

We recommend calling continue as new on both signal count and some time interval. For example once a week. This way, you can guarantee that after a week, all workflows are using the latest version.

Good to know. Thanks for the clarification. I’ll make sure this happens

One other question. Aside from continuing as new regularly, is there any best practice to confirm that it’s safe to remove a version branch?

My team is looking for some way to 100% know without a shadow of a doubt that a branch can be removed. Sounds like maybe the only way is to continueAsNew on some time interval to guarantee that after x days then the code can be safely removed.

You can list/count workflows that use a specific branch version.

Sorry I’m revisiting this just now. Is there some temporal CLI command that can list workflows and list what branch version the workflow is currently on? I don’t see any option that seems to match that.

You use the list command. There is a searchable attribute TemporalChangeVersion that contains the version information.

I see… it looks like that search attribute is only automatically upserted in Go. So if we’re using Java then I’m guessing we need to upsert it ourselves

Edit: Yeah seems like this is a known issue in Java Set TemporalChangeVersion when workflow version is updated · Issue #587 · temporalio/sdk-java · GitHub