Suppose I have a state machine that goes from state 1 to state 2 and to transition from 1 to 2 some actions need to be taken like performing CRUD operations on other services .Now suppose while transitioning from state 1 to state 2, the thread gets killed (some actions are performed and others are not) then in that case the State machine would be in a state that is neither completely state 1 nor state 2. What is the best way to handle these type of inconsistencies. One way that I can think of is making all the steps transactional (using patterns like 2PC or saga), other way is by making all the operations (involved in transition) idempotent and performing all the operations again. Is there any other better way to handle these type of inconsistencies in state machines?
Aucun commentaire:
Enregistrer un commentaire