Added workflow execution context to the workflow executred and workflow executing notifications (#4065)

This commit is contained in:
MariusVuscanNx 2023-05-25 23:54:16 +03:00 committed by GitHub
parent a842c694c3
commit 63ada68a20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -7,4 +7,4 @@ namespace Elsa.Workflows.Core.Notifications;
/// <summary>
/// A domain event that is published everytime a burst of execution completes.
/// </summary>
public record WorkflowExecuted(Workflow Workflow, WorkflowState WorkflowState) : INotification;
public record WorkflowExecuted(Workflow Workflow, WorkflowState WorkflowState, WorkflowExecutionContext WorkflowExecutionContext) : INotification;

View file

@ -6,4 +6,4 @@ namespace Elsa.Workflows.Core.Notifications;
/// <summary>
/// A domain event that is published before a burst of execution begins.
/// </summary>
public record WorkflowExecuting(Workflow Workflow) : INotification;
public record WorkflowExecuting(Workflow Workflow, WorkflowExecutionContext WorkflowExecutionContext) : INotification;

View file

@ -165,7 +165,7 @@ public class WorkflowRunner : IWorkflowRunner
var cancellationToken = workflowExecutionContext.CancellationToken;
// Publish domain event.
await _eventPublisher.PublishAsync(new WorkflowExecuting(workflow), cancellationToken);
await _eventPublisher.PublishAsync(new WorkflowExecuting(workflow, workflowExecutionContext), cancellationToken);
// Transition into the Running state.
workflowExecutionContext.TransitionTo(WorkflowSubStatus.Executing);
@ -182,7 +182,7 @@ public class WorkflowRunner : IWorkflowRunner
var result = workflow.ResultVariable?.Get(workflowExecutionContext.MemoryRegister);
// Publish domain event.
await _eventPublisher.PublishAsync(new WorkflowExecuted(workflow, workflowState), cancellationToken);
await _eventPublisher.PublishAsync(new WorkflowExecuted(workflow, workflowState, workflowExecutionContext), cancellationToken);
// Return workflow execution result containing state + bookmarks.
return new RunWorkflowResult(workflowState, workflowExecutionContext.Workflow, result);