Beispiel #1
0
        public async Task Handle(WorkflowExecutionPassCompleted notification, CancellationToken cancellationToken)
        {
            var detector = GetDetector();

            if (detector == null)
            {
                return;
            }

            var context      = notification.ActivityExecutionContext;
            var loopDetected = await detector.MonitorActivityExecutionAsync(context);

            if (loopDetected)
            {
                _logger.LogWarning(
                    "Infinite loop detected on activity {ActivityId} of workflow instance {WorkflowInstanceId} of workflow definition {WorkflowDefinitionId}",
                    context.ActivityId,
                    context.WorkflowInstance.Id,
                    context.WorkflowInstance.DefinitionId);

                await HandleLoopAsync(context);

                await detector.ResetAsync(context);
            }
        }
Beispiel #2
0
        public async Task Handle(WorkflowExecutionPassCompleted notification, CancellationToken cancellationToken)
        {
            var behavior = notification.WorkflowExecutionContext.WorkflowBlueprint.PersistenceBehavior;

            if (behavior == WorkflowPersistenceBehavior.ActivityExecuted || notification.ActivityExecutionContext.ActivityBlueprint.PersistWorkflow)
            {
                await SaveWorkflowAsync(notification.WorkflowExecutionContext.WorkflowInstance, cancellationToken);
            }
        }