public async Task <List <HistoryStateEvent> > GetOrchestrationHistoryAsync(string instanceId) { Trace.TraceInformation($"Getting history for instance with id - {this.instanceId}"); // GetOrchestrationHistoryAsync is exposed in the TaskHubClinet but requires execution id. // However, we need to get all the history records for an instance id not for specific execution. AzureStorageOrchestrationService service = (AzureStorageOrchestrationService)this.client.ServiceClient; string historyString = await service.GetOrchestrationHistoryAsync(instanceId, null); return(JsonConvert.DeserializeObject <List <HistoryStateEvent> >(historyString)); }
public async Task GetHistory(string connectionStringKey, string taskHubName, string instanceId) { Initialize(out _orchestrationService, out _client, connectionStringKey, taskHubName); var historyString = await _orchestrationService.GetOrchestrationHistoryAsync(instanceId, null); JArray history = JArray.Parse(historyString); JArray chronologicalHistory = new JArray(history.OrderBy(obj => (string)obj["TimeStamp"])); foreach (JObject jobj in chronologicalHistory) { // Convert EventType enum values to their equivalent string value Enum.TryParse(jobj["EventType"].ToString(), out EventType eventName); jobj["EventType"] = eventName.ToString(); } ColoredConsole.Write($"{chronologicalHistory.ToString(Formatting.Indented)}"); }