public TaskJob(TaskExecutionModel executionModel, TaskHandlerMetadata handlerMetadata, IServiceScope serviceScope, IJobExecutorContext executorContext) { if (executionModel == null) { throw new ArgumentNullException(nameof(executionModel)); } if (handlerMetadata == null) { throw new ArgumentNullException(nameof(handlerMetadata)); } if (executionModel.Timeout <= 0) { throw new ArgumentOutOfRangeException(nameof(executionModel.Timeout)); } TaskId = executionModel.TaskId; taskModel = executionModel.TaskModel; timeoutInMilliseconds = executionModel.Timeout; taskHandler = (ITaskHandler)serviceScope.ServiceProvider.GetRequiredService(handlerMetadata.HandlerType); this.executorContext = executorContext ?? throw new ArgumentNullException(nameof(executorContext)); }
public JobExecutorContextWrapper(Guid executorId, IJobExecutorContext executorContext) { ExecutorId = executorId; this.executorContext = executorContext; }