public override async Task PostPolicyAgentRequestAsync( Guid activityId, PolicyAgentRequest request, CancellationToken cancellationToken) { request.Validate("request"); switch (policyAgentStage) { case 0: SendImpactEnd(request); break; case 1: SendNewJobStep(request); break; case 2: SendImpactEndOnSecondUD(request); break; case 3: SendCompletion(request, true); break; } policyAgentStage++; await Task.FromResult(0); }
public async override Task PostPolicyAgentRequestAsync( Guid activityId, PolicyAgentRequest request, CancellationToken cancellationToken) { request.Validate("request"); switch (policyAgentStage) { case 0: SuspendAndResumeJob(request, TimeSpan.FromSeconds(15)); break; case 1: SendImpactEnd(request); break; case 2: SendCompletion(request, true); break; } policyAgentStage++; await Task.FromResult(0); }
public async Task PostPolicyAgentRequestAsync(Guid activityId, PolicyAgentRequest request, CancellationToken cancellationToken) { request.Validate("request"); traceType.WriteInfo("Posting request: {0}", request.ToJson()); var startTime = DateTimeOffset.UtcNow; try { byte[] payload = request.GetPayloadFromBondObject(); await PostDocumentToWireServerAsync(payload).ConfigureAwait(false); activityLogger.LogOperation(activityId, startTime); } catch (Exception ex) { string text = "Unable to post policy document. Request: {0}{1}Error: {2}".ToString( request.ToJson(), Environment.NewLine, ex); traceType.WriteWarning("{0}", text); activityLogger.LogOperation(activityId, startTime, OperationResult.Failure, ex); throw new ManagementException(text, ex); } }
public async override Task PostPolicyAgentRequestAsync( Guid activityId, PolicyAgentRequest request, CancellationToken cancellationToken) { request.Validate("request"); switch (policyAgentStage) { case 0: SendImpactEnd(request); break; case 1: SendNewJobStep(request, 1, new List <string> { "Role_IN_2", "Role_IN_3" }); break; case 2: SendImpactEndOnSecondUD(request); break; case 3: SendNewJobStep(request, 0, new List <string> { "Role_IN_0", "Role_IN_1" }); break; case 4: SendImpactEnd(request); break; case 5: SendNewJobStep(request, 1, new List <string> { "Role_IN_2", "Role_IN_3" }); break; case 6: SendImpactEndOnSecondUD(request); break; case 7: SendCompletion(request, true); break; } policyAgentStage++; await Task.FromResult(0); }
public override async Task PostPolicyAgentRequestAsync( Guid activityId, PolicyAgentRequest request, CancellationToken cancellationToken) { request.Validate("request"); if (policyAgentStage == 0) { SendImpactEnd(request); } else if (policyAgentStage == 1) { SendCompletion(request, true); } policyAgentStage++; await Task.FromResult(0); }
protected void SendCompletion(PolicyAgentRequest request, bool deleteJobStep = false) { request.Validate("request"); foreach (JobStepResponse jobStepResponse in request.JobResponse.JobStepResponses) { Guid guid = jobStepResponse.JobId.ToGuid(); var id = guid; var tenantJob = GetTenantJob(id); ((MockTenantJob)tenantJob).JobStatus = JobStatusEnum.Completed; if (deleteJobStep && tenantJob.JobStep != null) { ((MockTenantJob)tenantJob).JobStep = null; } // update job after it does its job, so that IS gets it again when it polls for it. UpdateTenantJob(tenantJob); } }