diff --git a/src/core/Elsa.Core/Handlers/PersistWorkflow.cs b/src/core/Elsa.Core/Handlers/PersistWorkflow.cs index b2470959f..0e53bff60 100644 --- a/src/core/Elsa.Core/Handlers/PersistWorkflow.cs +++ b/src/core/Elsa.Core/Handlers/PersistWorkflow.cs @@ -15,7 +15,8 @@ namespace Elsa.Handlers INotificationHandler, INotificationHandler, INotificationHandler, - INotificationHandler + INotificationHandler, + INotificationHandler { private readonly IWorkflowInstanceStore _workflowInstanceStore; private readonly ILogger _logger; @@ -94,6 +95,16 @@ namespace Elsa.Handlers } } + public async Task Handle(ActivityExecuted notification, CancellationToken cancellationToken) + { + _logger.LogTrace("Received notification {notification}", notification); + + var behavior = notification.WorkflowExecutionContext.WorkflowBlueprint.PersistenceBehavior; + + if (behavior == WorkflowPersistenceBehavior.ActivityExecuted) + await SaveWorkflowAsync(notification.WorkflowExecutionContext, cancellationToken); + } + private async ValueTask SaveWorkflowAsync(WorkflowExecutionContext workflowExecutionContext, CancellationToken cancellationToken) { _logger.LogTrace("Persisting workflow instance {instanceId}", workflowExecutionContext.WorkflowInstance.Id);