by websiteapi · 1y ago · 0 comments
you can (and people already) model steps in any arbitrarily large workflow and have those results be processed in a modular fashion and have whatever process that begins this workflow check the state of the necessary preconditions prior to taking any action and thus go to the currently needed step, or retry ones that failed, and so forth.
- Checking the status of a task (queued, pending, failed, cancelled, completed) - Cancelling a queued task (or pending task if the execution environment supports it) - Re-prioritizing queued tasks - Searching for tasks based off an attribute (e.g. tag)
You really do need a database for this.
It is a queue if we squint really hard, but it allows random access and reordering. Do we have durable structures of this kind?
I can’t imagine how to shoehorn this into Kafka or SQS.
Short answer: we need to be able to redeploy and bounce the orchestrator without worrying about what stage each running VM on our platform is in.
JP, the dev that built this out for us, talks a bit about the design rationale (search for "Cadence") here:
https://fly.io/blog/the-exit-interview-jp/
The library itself is open:
Yup. Being able to write imperative code that automatically resumes where it left off is very valuable. It's best to represent durable turing completeness using modern approaches of authoring such logic - programming languages. Being able to loop, try/catch, apply advanced conditional logic, etc in a crash-proof algorithm that can run for weeks/months/years and is introspectable has a lot of value over just using queues.
Durable execution is all just queues and task processing and event sourcing under the hood though.