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); }
public async Task<BatchJobExecutionResult> Execute(BatchJob batchJob) { var type = batchJob.GetType(); var hasExecutorType = _executorTypeList.ContainsKey(type); if (hasExecutorType) { var batchJobExecutor = _kernel.Get(_executorTypeList[type]) as IBatchJobExecutor; if (batchJobExecutor != null) return await batchJobExecutor.Execute(batchJob); } return await _kernel.Get<DefaultBatchJobExecutor>().Execute(batchJob); }