Пример #1
0
        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;
            }
        }
Пример #2
0
        public void Handle(WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step, Exception exception, Queue <ExecutionPointer> bubbleUpQueue)
        {
            workflow.Status = WorkflowStatus.Suspended;
            _eventPublisher.PublishNotification(new WorkflowSuspended
            {
                EventTimeUtc         = _datetimeProvider.UtcNow,
                Reference            = workflow.Reference,
                WorkflowInstanceId   = workflow.Id,
                WorkflowDefinitionId = workflow.WorkflowDefinitionId,
                Version = workflow.Version
            });

            step.PrimeForRetry(pointer);
        }
Пример #3
0
 public void Handle(WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step, Exception exception, Queue <ExecutionPointer> bubbleUpQueue)
 {
     pointer.RetryCount++;
     pointer.SleepUntil = _datetimeProvider.UtcNow.Add(step.RetryInterval ?? def.DefaultErrorRetryInterval ?? _options.ErrorRetryInterval);
     step.PrimeForRetry(pointer);
 }