private void SelectErrorStrategy(WorkflowErrorHandling errorOption, WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step) { switch (errorOption) { case WorkflowErrorHandling.Retry: if (pointer.RetryCount >= def.DefaultErrorRetryLimit) { workflow.Status = WorkflowStatus.Suspended; break; } pointer.RetryCount++; pointer.SleepUntil = Clock.Now.ToUniversalTime().Add(step.RetryInterval ?? def.DefaultErrorRetryInterval ?? _options.ErrorRetryInterval); step.PrimeForRetry(pointer); break; case WorkflowErrorHandling.Suspend: workflow.Status = WorkflowStatus.Suspended; break; case WorkflowErrorHandling.Terminate: workflow.Status = WorkflowStatus.Terminated; break; case WorkflowErrorHandling.Compensate: Compensate(workflow, def, pointer); break; } }
public IStepBuilder <TData, TStepBody> OnError(WorkflowErrorHandling behavior, TimeSpan?retryInterval = null) { Step.ErrorBehavior = behavior; Step.RetryInterval = retryInterval; return(this); }