When should we use Worker Versioning, & when should we use Patch & GetVersion APIs for versioning?
Both are used together as well. I’m Confused. Can someone explain Why there’s a need of two strategies
Does this document help?
yes of course Bergundy, I’ve gone through it.
But the question is,
Both Versioning Workflow name and versioning worker achieve versioning in almost the same way.
For both of them we need to maintain separate workflow code files.
isn’t Worker versioning making things complex?
Felt workflow name versioning is simpler because in name versioning, you just have other version of workflow file and call it for new workflows, But in worker versioning we need still maintain multiple workflow version files same as name versioning on top of that you need to have multiple workers, multiple task queues and also add build id’s to workers, which is making things more complex.
Please correct me if I’m wrong or if I am missing anything.
Thank you…
With worker versioning you don’t need to keep old versions of the code, you need to keep old workers.
It shifts the problem from the application developer to the service operator.
Hey bergundy, Thanks for the reply but,
I don’t get it…, Without keeping the old versions of code, how can we keep the old workers associated with the old versions, running?
you have to mention the path of workflow code in worker code, right…?
worker2 = await Worker.create({
workflowsPath: require.resolve(‘./workflowsV2’),
activities,
taskQueue,
buildId: ‘2.0’,
useVersioning: true,
});
The key here is that you don’t have to keep the old code side by side with the new code.
It’s there in source control and, typically, your workers are built into a docker image by your CI system.
At that point, you keep the worker images deployed for as long as there are workflow that need to run on them, and you can keep evolving your codebase independently (assuming you don’t need to patch running workflows).