Best Practice for Saga Completion

I am interested if it is better to request a timeout in every saga instance to ensure that MarkAsComplete() is called rather than any given saga inadvertently not calling MarkAsComplete() (maybe due to a coding issue) and having these saga instances live forever. Assume many thousands of saga instances per day.

Your document:


Since sagas, when they’re not processing messages, are effectively a record in a database, leaving a saga running “forever” is equivalent to not deleting a record from a database. This is similar to how regular business entities in a system are not deleted.

Can you tell me which is the better practice or maybe there a better one that I am not aware of.

Many Regards,

Hi Richard,

Rather that request the technical timeout I think the better way is to write a Unit Test checking if MarkAsComplete() is called when should be called.
When by accident MarkAsComplete() disappear then the test will fail and you will know that probably something goes wrong.

Hope this help.


Thank you. I think that is a great solution.

Also, thank you for the quick response.