public ScheduleJobResult StartExport([FromBody] ScheduleJobRequest request) { log.LogInformation($"StartExport: Url {request?.Url}"); JobRequest jobRequest = new JobRequest() { JobUid = Guid.Parse("c3cbb048-05c1-4961-a799-70434cb2f162"), SetupParameters = request, RunParameters = Request.Headers.GetCustomHeaders() }; log.LogInformation($"{nameof(StartExport)}: {JsonConvert.SerializeObject(request)}"); jobRequest.Validate(); jobRequest.AttributeFilters = SpecialFilters.ExportFilter; string hangfireJobId; try { hangfireJobId = jobRunner.QueueHangfireJob(jobRequest); } catch (Exception e) { log.LogError($"Queue VSS job failed with exception {e.Message}", e); throw; } //Hangfire will substitute a PerformContext automatically return(new ScheduleJobResult { JobId = hangfireJobId }); }
public void ValidateJobRequestSuccess() { var request = new JobRequest { JobUid = Guid.NewGuid() }; request.Validate(); }
// POST api/job public JobStatus Post([FromBody] JobRequest req) { string id; try { req.Validate(); id = client.SpawnNewJob(UserName, req.JobName, req.DllPath, req.InPath, req.OutFile); } catch (Exception ex) { return(new JobStatus() { JobId = null, Status = ex.Message }); } return(Get(id)); }
public ScheduleJobResult RunJob([FromBody] JobRequest request) { Log.LogInformation($"{nameof(RunJob)}: {JsonConvert.SerializeObject(request)}"); request.Validate(); string hangfireJobId; try { hangfireJobId = JobRunner.QueueHangfireJob(request); } catch (Exception e) { Log.LogError(e, $"Queue VSS job failed with exception {e.Message}"); throw; } //Hangfire will substitute a PerformContext automatically return(new ScheduleJobResult { JobId = hangfireJobId }); }
public void ValidateJobRequestFailure() { var request = new JobRequest(); Assert.ThrowsException <ServiceException>(() => request.Validate()); }
public Task <ContractExecutionResult> RunHangfireJob(JobRequest request, PerformContext context) { request.Validate(); return(RunJob(request, context)); }