resolve icon indicating copy to clipboard operation
resolve copied to clipboard

Provide a way to cancel or re-schedule saga's scheduled commands

Open VasilyStrelyaev opened this issue 3 years ago • 0 comments

In my scenario, I need to execute a command (let's call it terminate) if an aggregate is unused for a certain time t (i.e., receives no commands). So, I use a saga to schedule terminate in t milliseconds after every aggregate's command.

Ideally, I would like to re-schedule terminate every time a new command is received to reset the timer to t.

Being unable to do that, I have to handle all the unnecessary terminates in the aggregate, and reject them (by throwing an error) if the aggregate actually received some command in recent t milliseconds.

Luckily, my terminate command targets the same aggregate, so I can double-check if there were more recent commands in its state. If it was a different aggregate, I would have to make even more roundtrips between aggregates.

VasilyStrelyaev avatar Jul 30 '21 14:07 VasilyStrelyaev