Example #1
0
        private async Task <BatchJobExecutionResult> Execute(T batchJob)
        {
            _setBatchJobJobExecutionStatus.Starting(batchJob);
            BatchJobExecutionResult result = await(UseAsync ? OnExecuteAsync(batchJob) : Task.FromResult(OnExecute(batchJob)));

            _setBatchJobJobExecutionStatus.Complete(batchJob, result);
            return(result);
        }
Example #2
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);
     });
 }
Example #3
0
 public async Task <BatchJobExecutionResult> Execute(BatchJob batchJob)
 {
     return(await BatchJobExecutionResult.TryAsync(() =>
     {
         T job = batchJob as T;
         return job == null
             ? Task.FromResult(BatchJobExecutionResult.Failure("Batch job is not of the correct type"))
             : Execute(job);
     }));
 }
Example #4
0
        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));
        }