I'm using Masstransit 5.1.4 with sagas. I have a saga where I want to implement the following behaviour:
- When a StartMsg is received -> transition to Active state
- While in Active state, several events are processed
- If a StartMsg is received in this state, the current saga is finalized and reprocess the StartMsg within a new saga instance
How can I achieve this?
Here is a small pseudocode
Initially(
When(StartEvt)
.Then(...)
.TransitionTo(Active)
);
During(Active,
When(OneEvt)
.Then(...),
When(AnotherEvt
.Then(...),
When(EndEvt)
.Finalize(),
When(StartEvt)
// Finalize current saga
// Transition to initial state reprocessing StartMessage bound to StartEvt