public static void ReplayInstance(TaskHubClient client, DebugTestHost replayer, OrchestrationInstance instance) { string history = client.GetOrchestrationHistory(instance); if (!string.IsNullOrEmpty(history)) { Helpers.ConsoleWriteLineColor(ConsoleColor.Yellow, string.Format("Attach debugger to debug orchestration instance: [InstanceId={0}, ExecutionId={1}]", instance.InstanceId, instance.ExecutionId)); Helpers.WaitForDebugger(); replayer.ReplayOrchestration(typeof(UtilitySignupOrchestration), history); } else { Helpers.ConsoleWriteLineColor(ConsoleColor.Red, string.Format("Orchestration instance '[InstanceId={0}, ExecutionId={1}]' not found.", instance.InstanceId, instance.ExecutionId)); } }
public static void Monitor(TaskHubClient client, string command, string[] parameters) { switch (command) { case "Dump": int hours = 5; if (parameters != null && parameters.Length == 1) { hours = int.Parse(parameters[0]); } Helpers.DumpAllInstances(client, hours); break; case "DumpStatus": int h = 5; if (parameters != null && (parameters.Length == 1 || parameters.Length == 2)) { if (parameters != null && parameters.Length == 2) { h = int.Parse(parameters[1]); } Helpers.DumpAllInstancesForState(client, (OrchestrationStatus)Enum.Parse(typeof(OrchestrationStatus), parameters[0]), h); } else { throw new ArgumentException("DumpStatus parameters not provided. Please specify orchestration status to query for."); } break; case "GetStatus": if (parameters != null && parameters.Length == 2) { OrchestrationInstance instance = new OrchestrationInstance { InstanceId = parameters[0], ExecutionId = parameters[1], }; Helpers.PrintOrchestrationStatus(client, instance); } else { throw new ArgumentException("GetStatus parameters not provided."); } break; case "GetHistory": if (parameters != null && parameters.Length == 2) { OrchestrationInstance instance = new OrchestrationInstance { InstanceId = parameters[0], ExecutionId = parameters[1], }; Helpers.PrintOrchestrationHistory(client, instance); } else { throw new ArgumentException("History parameters not provided."); } break; case "Replay": if (parameters != null && parameters.Length == 2) { OrchestrationInstance instance = new OrchestrationInstance { InstanceId = parameters[0], ExecutionId = parameters[1], }; DebugTestHost replayer = new DebugTestHost(); replayer.AddTaskOrchestrations(typeof(UtilitySignupOrchestration)); Helpers.ReplayInstance(client, replayer, instance); } else { throw new ArgumentException("Replay parameters not provided."); } break; default: throw new ArgumentException("Unsupported monitoring command: " + command); } }