You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to use orchestration versioning in Durable Task Scheduler.
4
4
ms.topic: how-to
5
5
ms.date: 07/16/2025
6
+
author: halspang
7
+
ms.author: azfuncdf
6
8
zone_pivot_groups: df-languages
7
9
---
8
10
9
11
# Orchestration Versioning
10
12
11
-
A key area to consider when using a durable orchestration system is how to handle the upgrading/downgrading of orchestrations. When an orchestration is interrupted and later resumed (for instance, during a host update), Durable Task Scheduler will replay the events of the orchestration. This is done to ensure that the orchestration executes the same steps each time which is a core promise of the durable execution paradigm. So, if an orchestration changes between deployments, the steps it takes may no longer be the same. If this does happen, the system will provide a `NonDeterministicError` instead of allowing the orchestration to continue.
13
+
A key area to consider when using a durable orchestration system is how to handle the upgrading/downgrading of orchestrations. When an orchestration is interrupted and later resumed (for instance, during a host update), Durable Task Scheduler will replay the events of the orchestration. This is done to ensure reliability - the system replays to ensure all previous steps were executed successfully before the next step is taken - which is a core promise of the durable execution paradigm. So, if an orchestration changes between deployments, the steps it takes may no longer be the same. If this does happen, the system will throw a `NonDeterministicError` instead of allowing the orchestration to continue.
12
14
13
-
Now, with orchestration versioning, there is a way to prevent this and work seamlessly with new (or old) orchestrations. Durable Task Scheduler has two different styles of versioning which will be explored below. Note that the different versioning styles can be used separately or together.
15
+
Orchestration versioning helps to prevent problems related to non-determinism, allowing you to work seamlessly with new (or old) orchestrations. Durable Task Scheduler has two different styles of versioning which will be explored below. Note that the different versioning styles can be used separately or together.
14
16
15
17
::: zone pivot="javascript"
16
18
@@ -27,20 +29,23 @@ Now, with orchestration versioning, there is a way to prevent this and work seam
27
29
::: zone pivot="python"
28
30
29
31
> [!IMPORTANT]
30
-
> Currently, versioning is not available in the Python SDK.
32
+
> Currently, versioning isn't available in the Python SDK.
31
33
32
34
::: zone-end
33
35
34
36
::: zone pivot="csharp,java"
35
37
36
-
## Client/Context Based Conditional Versioning
38
+
## Client/context-based conditional versioning
37
39
38
-
In order for an orchestration to have a version, it must first be set in the client. For the .NET SDK, this is done through the standard host builder extensions, as seeen below:
40
+
In order for an orchestration to have a version, it must first be set in the client. For the .NET SDK, this is done through the standard host builder extensions, as seen below:
@@ -66,9 +74,9 @@ public DurableTaskClient durableTaskClient(DurableTaskProperties properties) {
66
74
67
75
::: zone pivot="csharp,java"
68
76
69
-
Once that is added, any orchestration started by this host will use the version `1.0.0`. The version itself is a simple string and accepts any value. However, the SDK will try and convert it to .NET's `System.Version`. If it can be converted, that library is used for comparison, if not, a simple string comparison is used.
77
+
Once that is added, any orchestration started by this host will use the version `1.0.0`. The version itself is a simple string and accepts any value. However, the SDK will try to convert it to .NET's `System.Version`. If it can be converted, that library is used for comparison, if not, a simple string comparison is used.
70
78
71
-
By supplying the version in the client, it also becomes available in the `TaskOrchestrationContext`. This means the version can be used in conditional statements. So, as long as newer versions of an orchestration have the appropriate version gating, both the old and the new version so of the orchestration can run together on the same host. An example of how the version can be used can be seen below:
79
+
By supplying the version in the client, it also becomes available in the `TaskOrchestrationContext`. This means the version can be used in conditional statements. Solong as newer versions of an orchestration have the appropriate version gating, both the old and the new version of the orchestration can run together on the same host. An example of how the version can be used is:
72
80
73
81
::: zone-end
74
82
@@ -124,24 +132,24 @@ public TaskOrchestration create() {
124
132
125
133
In this example, we've added a `SayGoodbye` activity to the `HelloCities` orchestration. This is only called if the orchestration is at least version `2.0.0`. With the simple conditional statement, any orchestration with a version less than `2.0.0` will continue to function and any new orchestration will have the new activity in it.
126
134
127
-
### When to Use Client Versioning
135
+
### When to use client versioning
128
136
129
137
Client versioning provides the simplest mechanism for versioning orchestrations, but interacting with the version is also the most programming intensive. Essentially, the two functionalities that client versioning provides are the ability to set a version for all orchestrations and the ability to programmatically handle the version in the orchestration. It should be used if a standard version is desired across all versions or if custom logic around specific versions is required.
130
138
131
-
## Worker Based Versioning
139
+
## Worker-based versioning
132
140
133
-
An additional strategy that can be used for handling versions is setting up worker versioning. Orchestrations will still need a client version in order to have the version set, but this method allows the user to avoid conditionals in their orchestrations. Worker versioning allows the worker itself to choose how to act on different version so of orchestrations before those orchestrations start executing. Worker versioning has several fields to set, which are detailed below:
141
+
An additional strategy that can be used for handling versions is setting up worker versioning. Orchestrations will still need a client version in order to have the version set, but this method allows the user to avoid conditionals in their orchestrations. Worker versioning allows the worker itself to choose how to act on different version of orchestrations before those orchestrations start executing. Worker versioning requires the following fields to be set:
134
142
135
143
1. The version of the worker itself
136
-
2. The default version that will be applied to sub-orchestrations started by the worker
144
+
2. The default version that will be applied to suborchestrations started by the worker
137
145
3. The strategy that the worker will use to match against the orchestration's version
138
-
4. The strategy that the worker should take if the version does not meet the matching strategy
146
+
4. The strategy that the worker should take if the version doesn't meet the matching strategy
The `Reject` failure strategy should be used when the desired behavior is to have the orchestration try again at a later time/on a different worker. When an orchestration is rejected, it is simply returned to the work queue. When it is dequeued again, it could land on a different worker or the same one again. The process will repeat until a worker that can actually handle the orchestration is available. This strategy allows for the seamless handling of deployments in which an orchestration is updated. As the deployment progresses, workers that cannot handle the orchestration will reject it while workers that can handle it will. The ability to have mixed workers/orchestration versions allows for scenarios like blue-green deployments.
236
+
The `Reject` failure strategy should be used when the desired behavior is to have the orchestration try again at a later time/on a different worker. When an orchestration is rejected, it's simply returned to the work queue. When it's dequeued again, it could land on a different worker or the same one again. The process will repeat until a worker that can actually handle the orchestration is available. This strategy allows for the seamless handling of deployments in which an orchestration is updated. As the deployment progresses, workers that can't handle the orchestration will reject it while workers that can handle it will process it. The ability to have mixed workers/orchestration versions allows for scenarios like blue-green deployments.
229
237
230
-
The `Fail` failure strategy should be used when no other versions are expected. In this case, the new version is an anomoly and no worker should even attempt to work on it. So, the Durable Task Scheduler will fail the orchestration, putting it in a terminal state.
238
+
The `Fail` failure strategy should be used when no other versions are expected. In this case, the new version is an anomaly and no worker should even attempt to work on it. So, the Durable Task Scheduler will fail the orchestration, putting it in a terminal state.
231
239
232
240
### When to Use Worker Versioning
233
241
234
-
Worker versioning should be used in instances where the desired reaction for an orchestration of an unknown or unsupported version should not be worked on at all. Instead of placing version handling code in the worker, worker versioning stops the orchestration from ever executing. This allows for much simpler code in the orchestrations themselves. Without any code changes to them, various deployment scenarios can be handled, like blue-green deployments mentioned before.
242
+
Worker versioning should be used in scenarios where orchestrations of an unknown or unsupported version shouldn't be executed at all. Instead of placing version handling code in the worker, worker versioning stops the orchestration from ever executing. This allows for much simpler orchestration code. Without any code changes, various deployment scenarios can be handled, like blue-green deployments mentioned before.
0 commit comments