Need versioning for workflow type migration

I asked a similar question before,

To give some context - our workflow has a wait period of a month, so for all executions to migrate to new workflow type with versioning, it will take at least a month.

  val version = Workflow.getVersion("switchToSecondWorkflow", Workflow.DEFAULT_VERSION, 1)
        if (version == Workflow.DEFAULT_VERSION) {
            val workflow = Workflow.newContinueAsNewStub(FirstWorkflow::class.java)
        workflow.execute(object)
        } else {
           val workflow = Workflow.newContinueAsNewStub(SecondWorkflow::class.java)
        workflow.execute(object)
       }

Wondering if versioning is absolutely required in this case or can we just do this as we are not modifying command sequence

From

 val workflow = Workflow.newContinueAsNewStub(FirstWorkflow::class.java)
        workflow.execute(object)

To

val workflow = Workflow.newContinueAsNewStub(SecondWorkflow::class.java)
        workflow.execute(object)

I recommend using the new worker versioning feature that covers upgrades when continue-as-new is called.

Looks like worker versioning feature is

we are on much older temporal server.

I think you don’t need to version the continue-as-new type. But I would test.

1 Like