Skip to content

Commit a6f0200

Browse files
committed
Support sub-orchestration default version
Sub orchestrations run through Durable Functions (as opposed to isolated with DTS) have a slightly different path for sub orchestration versioning. This change loads the default version provided by the properties field to use as the default sub orchestration version. Signed-off-by: Hal Spang <halspang@microsoft.com>
1 parent f457df9 commit a6f0200

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

client/src/main/java/com/microsoft/durabletask/OrchestrationRunner.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import com.google.protobuf.InvalidProtocolBufferException;
66
import com.google.protobuf.StringValue;
7+
import com.microsoft.durabletask.DurableTaskGrpcWorkerVersioningOptions.VersionFailureStrategy;
8+
import com.microsoft.durabletask.DurableTaskGrpcWorkerVersioningOptions.VersionMatchStrategy;
79
import com.microsoft.durabletask.implementation.protobuf.OrchestratorService;
810

911
import java.time.Duration;
@@ -125,12 +127,24 @@ public TaskOrchestration create() {
125127
}
126128
});
127129

130+
DurableTaskGrpcWorkerVersioningOptions versioningOptions = null;
131+
if (orchestratorRequest.getPropertiesMap().containsKey("defaultVersion")) {
132+
// If a default version is found, add it to the versioning options so it can be used in the execution flow.
133+
// It is safe to construct this here as we do not provide a client version nor a match/failure strategy that
134+
// would take effect. This is only used in the creation of sub-orchestrations.
135+
versioningOptions = new DurableTaskGrpcWorkerVersioningOptions(
136+
null,
137+
orchestratorRequest.getPropertiesMap().get("defaultVersion").getStringValue(),
138+
VersionMatchStrategy.NONE,
139+
VersionFailureStrategy.REJECT);
140+
}
141+
128142
TaskOrchestrationExecutor taskOrchestrationExecutor = new TaskOrchestrationExecutor(
129143
orchestrationFactories,
130144
new JacksonDataConverter(),
131145
DEFAULT_MAXIMUM_TIMER_INTERVAL,
132146
logger,
133-
null);
147+
versioningOptions);
134148

135149
// TODO: Error handling
136150
TaskOrchestratorResult taskOrchestratorResult = taskOrchestrationExecutor.execute(

0 commit comments

Comments
 (0)