danielgerlag / danielgerlag/workflow-core

If using EndWorkflow() no event for WorkflowCompleted LifeCycleEvent

Open
#1,353 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
5.9k
Forks
1.3k
Avg merge
1d 1h
Merged PRs (30d)
5

Description

**Describe the bug**
If I use EndWorkflow() at the end of my workflow, no LifeCycleEvent is published, but the workflow status is “Completed”.

**To Reproduce**
minimal example to reproduce:
public void Build(IWorkflowBuilder builder)
{
builder.UseDefaultErrorBehavior(WorkflowErrorHandling.Terminate)
.StartWith(context => { Console.WriteLine("Starting workflow"); })
.Then(context => { Console.WriteLine("processing"); })
.EndWorkflow();
}
subscribe to the LifeCycleEvents:
workflowHost.OnLifeCycleEvent += (evt) =>
{
switch (evt)
{
case WorkflowStarted workflowStartedEvent:
this.Logger.LogInformation($"Workflow started: {workflowStartedEvent.Reference}");
break;
case WorkflowCompleted workflowCompletedEvent:
this.Logger.LogInformation($"Workflow completed: {workflowCompletedEvent.Reference}");
break;
case WorkflowTerminated workflowErrorEvent:
this.Logger.LogError($"Workflow error: {workflowErrorEvent.Reference}");
break;
case WorkflowSuspended workflowSuspendedEvent:
this.Logger.LogInformation($"Workflow suspended: {workflowSuspendedEvent.Reference}");
break;
}
};

**Expected behavior**
I expect the ‘Completed’ LifeCycleEvent to be published even when using EndWorkflow()

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the minimal workflow using EndWorkflow() and subscribe through workflowHost.OnLifeCycleEvent. Trace how EndWorkflow() completes the workflow and how lifecycle events are published; done means a WorkflowCompleted event is emitted with the workflow reference when the status becomes “Completed”.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.