public void HandleFailure(IOddJobWithMetadata jobWithMetadata, Exception exception) { if (jobWithMetadata.RetryParameters == null || jobWithMetadata.RetryParameters.MaxRetries <= jobWithMetadata.RetryParameters.RetryCount) { _jobQueueManager.MarkJobFailed(jobWithMetadata.JobId); try { _jobStateExtension.OnJobFailed(jobWithMetadata); } catch (Exception ex) { //TODO: better logging. } } else { _jobQueueManager.MarkJobInRetryAndIncrement(jobWithMetadata.JobId, DateTime.Now); try { _jobStateExtension.OnJobRetry(jobWithMetadata); } catch (Exception ex) { //TODO: Better logging; } } }