I suppose I have the following use case:

  • I want a synchronous service if possible (in case of machine crash I want to finish it in background, by some other node)
  • I want to save something in my database and publish an event to an event stream like kafka or kinesis (which means 2 transactions db + evt stream)

I am stateless with dockers so I don't know if the transaction machine that recovers is the same that died previously. So the question is how do I make sure such a transaction finished?

I was wondering about async transaction but then my service cannot be synchronous, or I would create a transaction with a state and poll it while it gets handled asynchronously. What are common solutions? I just need to achieve eventual consistency

  • If you could stop and start all over, do it right now. Don't ever mess up with synchronous services and 2-phase commits. Check out this series. – Zapadlo Jan 19 '18 at 9:56
  • Ok so I'll just queue every request somewhere... generate a random uuid of the transaction(request) and queue execution of it somewhere and wait until that transaction has some state set to finished and return a result? This way I could just retry the command until it's completed if some catastrophic hardware failure would arrise – Martin Kosicky Jan 19 '18 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.