lundi 29 juillet 2019

Which design pattern to use for sequential actions and Retries

There is a use case, where a message is created.

The message will be be processed sequentially by different functions until it reaches terminal status.

After each function has processed the status of the message is updated to track the progress. If for any scenario, there is a system issue and we want to retry the same message, then it should start of where it left off based on the status.

Which is the better design pattern to use. State machine or Chain of responsibility. Is there any other pattern which can be recommended for this scenario.

A crude example:

Message (Created with New Status) ----> Function1 Prcoessing --> Message (Status updated to FUNC1COMPLETE) --> etc... till it reachers terminal status.

Aucun commentaire:

Enregistrer un commentaire