Describe the bug
Very simpified, If I use step definition like this:
public async override Task<ExecutionResult> RunAsync(IStepExecutionContext context) { return ExecutionResult.WaitForEvent("Test", null, DateTime.Now); }
and after in other part of the code:
await wfHost.PublishEvent("Test", null);
behavior is like this:
After the first enterance in the step, execution pointer is created, then return happens. Execution pointer is in status WaitingForEvent, subscription is created. So far so good. After event publishing, step is waking up, events is written to db, subscription is deleted, so, all good. Then after returning again, step is again in Wait for event status, still good. But then other publishing the same event does not wake up step anymore...
To Reproduce
Described above
Expected behavior
I expect to reenter the step, except if this is normal behavior, then I apologise for raising the ticket.
Additional context
Problem I am trying to solve is state based locking, which means that I have condition I want to be met, and only then to continue with the step. Same event can raise many times and I just want it to be the trigger, but the state is still my source of truth. Something like this:
public async override Task<ExecutionResult> RunAsync(IStepExecutionContext context) { if (conditionMet) return ExecutionResult.Next(); else return ExecutionResult.WaitForEvent("Test", null, DateTime.Now); }
Also I noticed one more thing, so wandering if that is normal too. If event happens before step with this code starts, code will not continue in a way that it awakes immediately. It will behave as expected if event comes after step created subscription, but this behavior is not the same if using declarative embedded WaitFor step from Workflow core. In this case even if event comes earlier, step will consider event is there and continue.
Describe the bug
Very simpified, If I use step definition like this:
public async override Task<ExecutionResult> RunAsync(IStepExecutionContext context) { return ExecutionResult.WaitForEvent("Test", null, DateTime.Now); }and after in other part of the code:
await wfHost.PublishEvent("Test", null);behavior is like this:
After the first enterance in the step, execution pointer is created, then return happens. Execution pointer is in status WaitingForEvent, subscription is created. So far so good. After event publishing, step is waking up, events is written to db, subscription is deleted, so, all good. Then after returning again, step is again in Wait for event status, still good. But then other publishing the same event does not wake up step anymore...
To Reproduce
Described above
Expected behavior
I expect to reenter the step, except if this is normal behavior, then I apologise for raising the ticket.
Additional context
Problem I am trying to solve is state based locking, which means that I have condition I want to be met, and only then to continue with the step. Same event can raise many times and I just want it to be the trigger, but the state is still my source of truth. Something like this:
public async override Task<ExecutionResult> RunAsync(IStepExecutionContext context) { if (conditionMet) return ExecutionResult.Next(); else return ExecutionResult.WaitForEvent("Test", null, DateTime.Now); }Also I noticed one more thing, so wandering if that is normal too. If event happens before step with this code starts, code will not continue in a way that it awakes immediately. It will behave as expected if event comes after step created subscription, but this behavior is not the same if using declarative embedded WaitFor step from Workflow core. In this case even if event comes earlier, step will consider event is there and continue.