Added workflow execution context to the workflow executred and workflow executing notifications (#4065)
This commit is contained in:
parent
a842c694c3
commit
63ada68a20
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue