News for hackers. Stuff that matters.

fortunaTemporal

Re:Saga Pattern Made Easy on Wednesday May 31, 2023 @02:05PM (#36141546)
One pattern is having a Workflow that runs as long as the lifetime of a domain object and holds a conceptual lock on that object—it receives requests to modify the object, and makes sure to only perform one operation at a time. (like the state pattern on a particular agent)

Also related: Signals are events that you can send to Workflows and between Workflows, and they’re always delivered in the order they’re received.

More generally, for a handy reference of Distributed Systems patterns, check out https://microservices.io/patterns/data/saga.html (though I personally find his diagrams a bit...overwhelming) and the MSN writeups: https://learn.microsoft.com/en-us/azure/architecture/pattern...

Re:Saga Pattern Made Easy on Wednesday May 31, 2023 @12:03PM (#36139931)
Temporal has an event queue under the covers, so you don't have to implement (and debug) that yourself.
Re:Saga Pattern Made Easy on Tuesday May 30, 2023 @06:06PM (#36131618)
But in the scenario that the Saga pattern handles, you have at least TWO databases, and multiple processes can be modifying them in the meanwhile. It IS a gordian knot and you don't have a known clear place to restore from.
Re:Saga Pattern Made Easy on Tuesday May 30, 2023 @06:04PM (#36131586)
Here's the mind-blowing thing: Temporal handles those type 2 failures for you. So they are the footnote, and then the saga pattern can take up the whole article
Re:Saga Pattern Made Easy on Tuesday May 30, 2023 @05:20PM (#36131016)
Agree with what other commenters have said. Also wanted to say that with Temporal you can code Sagas in Go, Java, TypeScript, and PHP, and they're working on expanding to other languages as well.
Re:Saga Pattern Made Easy on Tuesday May 30, 2023 @05:07PM (#36130807)
Author of the article here. Yeah, @agumonkey I like that analogy a lot!

Generally, that's a good way of thinking about it. The one additional bit of nuance is it's like a "safe" stack unwind while other processes could be still modifying databases at the same time, so it's not a complete "rollback" of the whole world if that makes sense.