Migrate long running older workflows

Hi Team,

I am having a lifecycle workflow. In the future when there are drastic code changes where end to end logic changes and providing backward compatibility support with versions are not possible with the new implementation.

Is Terminate and continueAsNewWorkflow for all older workflows using tctl commands the only option or is there any other possibilities to handle programatically?

2 Likes

You can call continue as new using different workflow type. So you can first create a new workflow type with the new implementation and then change the old one to use the new type for continue as new.

Hi Maxim,

Thank you so much for your reply. Do you have any documentation or sample application explaining this scenario?

I don’t think we have a sample for such migration. The basic idea is to use a stub of a different workflow type to call continue as new.

Hi @maxim
A follow up question on this.

Suppose the long running old WF Defn has a set of activities in some order and now in the new WF it’s totally different activities and code logic, then the idea is to just update the code of the old WF Defn to invoke Continue As New on the new Workflow type right?
Asking specifically since in this case the determinism of the Old WF Defn is lost in terms of the history it already has (as it’s long running).

then the idea is to just update the code of the old WF Defn to invoke Continue As New on the new Workflow type right?

If you have running executions yes can add continueasnew to your new workflow type. Safe would be to version this change.
For cases where you dont worry about the position(s) the current executions are you could add a new signal handler (would not need versioning) and make the continueasnew call in this handler, then signal all your running workflows, just idea.