We have one workflow and one activity that got changed as follows.
Initial version:
type FooWorkflowParams struct {
printFoo bool
}
FooWorkflow(params *FooWorkflowParams) {
workflow.ExecuteActivity(FooActivity, FooActivityParams{printFoo: params.printFoo})
}
type FooActivityParams struct {
printFoo bool
}
FooActivity(params *FooActivityParams) {
if params.printFoo {
fmt.Println("foo")
}
}
Updated version (Adds the ability to print Bar)
type FooWorkflowParams struct {
printFoo bool
printBar bool
}
FooWorkflow(params *FooWorkflowParams) {
workflow.ExecuteActivity(FooActivity, FooActivityParams{printFoo: params.printFoo, printBar: params.printBar})
}
type FooActivityParams struct {
printFoo bool
printBar bool
}
FooActivity(params *FooActivityParams) {
if params.printFoo {
fmt.Println("foo")
}
if params.printBar {
fmt.Println("bar")
}
}
Suppose there are two workers(both having the capability to run the workflow and activity) and only one of the worker W1 got upgraded with the new versions but not W2. Now, if the W1 handles a new workflow request and the activity fired by this workflow lands on W2 which is not yet upgraded, what’s the recommended way to make sure that W2 doesn’t handle this activity? Creating a new activity name every time the activity is updated and registering all the older and newer activities doesn’t appear to be a clean way of writing and maintaining the code.
Given that workflow is setting ‘printBar’, it assumes that ‘bar’ is printed and it’s important that ‘bar’ is actually printed.