public void RetryOrPoison(Job job, Exception exception, JobContext context) { if (job == null) { throw new ArgumentNullException("job"); } if (exception == null) { throw new ArgumentNullException("exception"); } if (context == null) { throw new ArgumentNullException("context"); } var config = _configuration.For(job.Type); if (job.DispatchCount <= config.RetryCount) { _recoverableAction.Run(() => job = _statusChanger.Change(job, JobStatus.Failed), then: () => _failedJobQueue.Add(job)); } else { context.Exception = exception; _jobCoordinator.Run(job, () => _statusChanger.Change(job, JobStatus.Poisoned)); } }
public Job Transit(Job job) { return(_jobMutator.Mutate <FailedTransition>(job, status: JobStatus.Failed, retryOn: _now() + _configuration.For(job.Type).RetryDelay)); }