Beispiel #1
0
 public void Complete <T>(T entity, BatchJobExecutionResult result) where T : SystemEntity, IHaveJobExecutionStatus
 {
     _session.Transact(session =>
     {
         entity.Status = result.Successful ? JobExecutionStatus.Succeeded : JobExecutionStatus.Failed;
         session.Update(entity);
     });
 }
        public Task <BatchJobExecutionResult> Execute(BatchJob batchJob)
        {
            var message = string.Format("There is no executor for this job. To create one, implement {0}<{1}>",
                                        typeof(IBatchJobExecutor).FullName,
                                        batchJob.GetType().FullName);
            var batchJobExecutionResult = BatchJobExecutionResult.Failure(message);

            _setBatchJobExecutionStatus.Complete(batchJob, batchJobExecutionResult);
            return(Task.FromResult(batchJobExecutionResult));
        }
Beispiel #3
0
 public async Task <BatchJobExecutionResult> Execute(BatchJob batchJob)
 {
     return(await BatchJobExecutionResult.TryAsync(() =>
     {
         var job = batchJob as T;
         return job == null
             ? Task.FromResult(BatchJobExecutionResult.Failure("Batch job is not of the correct type"))
             : Execute(job);
     }));
 }