Skip to content

Commit

Permalink
Create WriteWorkflowSuspendExecutionLog.cs (#4255)
Browse files Browse the repository at this point in the history
  • Loading branch information
promontis authored Jul 20, 2023
1 parent 6d0f5ea commit 4810fa5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/Elsa.Core/Handlers/WriteWorkflowSuspendExecutionLog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Elsa.Events;
using Elsa.Models;
using MediatR;

namespace Elsa.Handlers;

public class WriteWorkflowSuspendExecutionLog : INotificationHandler<WorkflowSuspended>
{
public Task Handle(WorkflowSuspended notification, CancellationToken cancellationToken)
{
var context = notification.WorkflowExecutionContext;
var blockingActivity = context.WorkflowInstance.BlockingActivities.First();
context.WorkflowExecutionLog.AddEntry(context.WorkflowInstance.Id, blockingActivity.ActivityId, blockingActivity.ActivityType, nameof(WorkflowStatus.Suspended), null, null, null, null);
return Task.CompletedTask;
}
}

0 comments on commit 4810fa5

Please sign in to comment.