-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
I'm trying to achieve the following:
while a request is on draft mode, the workflow keeps waiting for an update event. once that event is published, it updates the request with the new status. if its still in draft, it remains in the loop. The problem is that because the event is published once, the next time the loop runs and it will WaitFor the event, it assumes the that the event is already there and keeps updating and going through an infinite loop.
Any thoughs on a way around this?
here is my code:
builder
.StartWith<CreateTravelRequest>()
.Input(step => step.TravelRequestWorkflowData, data => data.TravelRequestWorkflowData)
.Output(data => data.TravelRequestWorkflowData, step => step.TravelRequestWorkflowData)
.While(data => data.TravelRequestWorkflowData.TravelRequest.StatusSlug == "DRAFT")
.Do(x => x
.StartWith(context => Log.Information("IN THE WHILE"))
.WaitFor("UPDATED", data => data.TravelRequestWorkflowData.TravelRequestId.ToString())
.Output(data => data.TravelRequestWorkflowData, step => step.EventData)
.Then<UpdateTravelRequest>()
.Input(step => step.TravelRequestWorkflowData, data => data.TravelRequestWorkflowData)
)
.Then<SubmitTravelRequest>()
.Input(step => step.TravelRequestWorkflowData, data => data.TravelRequestWorkflowData)
Metadata
Metadata
Assignees
Labels
No labels