public async Task Rewind(string connectionStringKey, string taskHubName, string instanceId, string reason) { Initialize(out _orchestrationService, out _client, connectionStringKey, taskHubName); var oldStatus = await _client.GetOrchestrationStateAsync(instanceId, false); try { await _orchestrationService.RewindTaskOrchestrationAsync(instanceId, reason); } catch (ArgumentOutOfRangeException e) { // DurableTask.AzureStorage throws this error when it cannot find an orchestration instance matching the query throw new CliException("Orchestration instance not rewound. Must have a status of 'Failed', or an EventType of 'TaskFailed' or 'SubOrchestrationInstanceFailed' to be rewound."); } ColoredConsole.WriteLine($"Rewind message sent to instance '{instanceId}'. Retrieving new status now..."); // Wait three seconds before retrieving the updated status await Task.Delay(3000); var newStatus = await _client.GetOrchestrationStateAsync(instanceId, false); if (oldStatus != null && oldStatus.Count > 0 && newStatus != null && newStatus.Count > 0) { ColoredConsole.Write(Green("Status before rewind: ")); ColoredConsole.WriteLine($"{oldStatus[0].OrchestrationStatus}"); ColoredConsole.Write(Green("Status after rewind: ")); ColoredConsole.WriteLine($"{newStatus[0].OrchestrationStatus}"); } }
public Task RewindAsync(string reason) { Trace.TraceInformation($"Rewinding instance {this.instanceId} with reason = {reason}."); // The Rewind API currently only exists in the service object AzureStorageOrchestrationService service = (AzureStorageOrchestrationService)this.client.serviceClient; return(service.RewindTaskOrchestrationAsync(this.instanceId, reason)); }
public async Task RewindTaskOrchestrationAsync(string instanceId, string reason) { await _azureStorageOrchestrationService.RewindTaskOrchestrationAsync(instanceId, reason); }