public async Task SendJobResponseAsync( Guid activityId, int documentIncarnation, IReadOnlyDictionary <Guid, JobStepResponseEnum> jobResponseMap, string comment, CancellationToken cancellationToken) { jobResponseMap.Validate("jobResponseMap"); if (jobResponseMap.Count == 0) { traceType.WriteInfo("No job responses to send"); return; } if (documentIncarnation < 0) { throw new ArgumentException( "documentIncarnation is {0}. It cannot be less than 0".ToString(documentIncarnation), "documentIncarnation"); } ParallelJobResponse parallelJobResponse = BuildParallelJobResponse(documentIncarnation, jobResponseMap, comment); var policyAgentRequest = new PolicyAgentRequest { JobResponse = parallelJobResponse, }; await PostPolicyAgentRequestAsync(activityId, policyAgentRequest, cancellationToken).ConfigureAwait(false); }
private static ParallelJobResponse BuildParallelJobResponse( int documentIncarnation, IReadOnlyDictionary <Guid, JobStepResponseEnum> jobResponseMap, string comment) { var response = new ParallelJobResponse { DocumentIncarnation = documentIncarnation }; foreach (var responseEntry in jobResponseMap) { var jsr = GetJobStepResponse(responseEntry.Key, responseEntry.Value, comment); response.JobStepResponses.Add(jsr); } return(response); }