diff --git a/src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs b/src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs index 7e6709a2c..642482cbd 100644 --- a/src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs +++ b/src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs @@ -175,7 +175,7 @@ async Task IDurableOrchestrationClient.WaitForCompletionOrCreateC } /// - async Task IDurableOrchestrationClient.StartNewAsync(string orchestratorFunctionName, string instanceId, T input) + async Task IDurableOrchestrationClient.StartNewAsync(string orchestratorFunctionName, string instanceId, string instanceVersion, T input) { if (this.ClientReferencesCurrentApp(this)) { @@ -202,7 +202,7 @@ async Task IDurableOrchestrationClient.StartNewAsync(string orchestra OrchestrationStatus[] dedupeStatuses = this.GetStatusesNotToOverride(); Task createTask = this.client.CreateOrchestrationInstanceAsync( - orchestratorFunctionName, DefaultVersion, instanceId, input, null, dedupeStatuses); + orchestratorFunctionName, instanceVersion, instanceId, input, null, dedupeStatuses); this.traceHelper.FunctionScheduled( this.TaskHubName, @@ -1139,6 +1139,12 @@ Task IDurableOrchestrationClient.StartNewAsync(string orchestratorFun return ((IDurableOrchestrationClient)this).StartNewAsync(orchestratorFunctionName, string.Empty, input); } + /// + Task IDurableOrchestrationClient.StartNewAsync(string orchestratorFunctionName, string instanceId, T input) + { + return ((IDurableOrchestrationClient)this).StartNewAsync(orchestratorFunctionName, instanceId, string.Empty, input); + } + async Task IDurableOrchestrationClient.RestartAsync(string instanceId, bool restartWithNewInstanceId) { DurableOrchestrationStatus status = await ((IDurableOrchestrationClient)this).GetStatusAsync(instanceId, showHistory: false, showHistoryOutput: false, showInput: true); diff --git a/src/WebJobs.Extensions.DurableTask/ContextInterfaces/IDurableOrchestrationClient.cs b/src/WebJobs.Extensions.DurableTask/ContextInterfaces/IDurableOrchestrationClient.cs index b3113f7a3..95377f619 100644 --- a/src/WebJobs.Extensions.DurableTask/ContextInterfaces/IDurableOrchestrationClient.cs +++ b/src/WebJobs.Extensions.DurableTask/ContextInterfaces/IDurableOrchestrationClient.cs @@ -162,6 +162,25 @@ Task StartNewAsync( /// Task StartNewAsync(string orchestratorFunctionName, string instanceId, T input); + /// + /// Starts a new instance of the specified orchestrator function. + /// + /// + /// If an orchestration instance with the specified ID already exists, the existing instance + /// will be silently replaced by this new instance. + /// + /// The name of the orchestrator function to start. + /// The ID to use for the new orchestration instance. + /// The version to use for the new orchestration instance. + /// JSON-serializable input value for the orchestrator function. + /// The type of the input value for the orchestrator function. + /// A task that completes when the orchestration is started. The task contains the instance id of the started + /// orchestratation instance. + /// + /// The specified function does not exist, is disabled, or is not an orchestrator function. + /// + Task StartNewAsync(string orchestratorFunctionName, string instanceId, string instanceVersion, T input); + /// /// Sends an event notification message to a waiting orchestration instance. /// diff --git a/src/WebJobs.Extensions.DurableTask/LocalGrpcListener.cs b/src/WebJobs.Extensions.DurableTask/LocalGrpcListener.cs index a62b377b1..6c236e041 100644 --- a/src/WebJobs.Extensions.DurableTask/LocalGrpcListener.cs +++ b/src/WebJobs.Extensions.DurableTask/LocalGrpcListener.cs @@ -156,7 +156,7 @@ public override Task Hello(Empty request, ServerCallContext context) try { string instanceId = await this.GetClient(context).StartNewAsync( - request.Name, request.InstanceId, Raw(request.Input)); + request.Name, request.InstanceId, request.Version, Raw(request.Input)); return new P.CreateInstanceResponse { InstanceId = instanceId, diff --git a/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml b/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml index 0088042e9..5166c0ee4 100644 --- a/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml +++ b/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml @@ -175,7 +175,7 @@ - + @@ -226,6 +226,9 @@ + + + @@ -953,6 +956,25 @@ The specified function does not exist, is disabled, or is not an orchestrator function. + + + Starts a new instance of the specified orchestrator function. + + + If an orchestration instance with the specified ID already exists, the existing instance + will be silently replaced by this new instance. + + The name of the orchestrator function to start. + The ID to use for the new orchestration instance. + The version to use for the new orchestration instance. + JSON-serializable input value for the orchestrator function. + The type of the input value for the orchestrator function. + A task that completes when the orchestration is started. The task contains the instance id of the started + orchestratation instance. + + The specified function does not exist, is disabled, or is not an orchestrator function. + + Sends an event notification message to a waiting orchestration instance. diff --git a/src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.cs b/src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.cs index 53b7cca9e..292e18d06 100644 --- a/src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.cs +++ b/src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.cs @@ -42,6 +42,8 @@ public FunctionsOrchestrationContext(TaskOrchestrationContext innerContext, Func public override string InstanceId => this.innerContext.InstanceId; + public override string InstanceVersion => this.innerContext.InstanceVersion; + public override DateTime CurrentUtcDateTime => this.innerContext.CurrentUtcDateTime; public override bool IsReplaying => this.innerContext.IsReplaying;