Comment by dangoodmanUT

1 month ago

Maybe I'm not seeing it, but why do none of these "postgres durable packages" ever integrate with existing transactions? That's the biggest flaw of temporal, and seems so obvious that they can hook into transactions to ensure that starting a workflow is transactionally secure with other operations, and you don't have to manage idempotency yourself (or worry about handling "already started" errors and holding up DB connections bc you launched in transaction)

(DBOS co-founder here) DBOS does exactly this! From the post:

DBOS has a special @DBOS.Transaction decorator. This runs the entire step inside a Postgres transaction. This guarantees exactly-once execution for databases transactional steps.

  • Sorry, i mean with external transactions to the workflow steps. Like I can select, insert, and launch a workflow in a HTTP handler

    • Yeah, you can launch workflows directly from an HTTP handler. So here's some code that idempotently launches a background task from a FastAPI endpoint:

          @app.get("/background/{task_id}/{n}")
          def launch_background_task(task_id: str, n: int) -> None:
            with SetWorkflowID(task_id): # Set an idempotency key
              DBOS.start_workflow(background_task, n) # Start the workflow in the background
      

      Does that answer your question?

      5 replies →