|
5 | 5 | [](https://github.com/dbos-inc/dbos-transact-golang/releases) |
6 | 6 | [](https://discord.com/invite/jsmC6pXGgX) |
7 | 7 | [](LICENSE) |
| 8 | +[](https://github.com/dbos-inc/dbos-transact-golang) |
8 | 9 |
|
9 | 10 |
|
10 | 11 | # DBOS Transact: Lightweight Durable Workflow Orchestration with Postgres |
@@ -260,38 +261,63 @@ recvResult, err := recvHandle.GetResult() |
260 | 261 |
|
261 | 262 | </details> |
262 | 263 |
|
| 264 | +## Getting Started |
263 | 265 |
|
264 | | -## DBOS workflows |
| 266 | +To get started, follow the [quickstart](https://docs.dbos.dev/quickstart) to install this open-source library and connect it to a Postgres database. |
| 267 | +Then, check out the [programming guide](https://docs.dbos.dev/python/programming-guide) to learn how to build with durable workflows and queues. |
265 | 268 |
|
266 | | -A workflow can be any function with the following signature: |
267 | | -```golang |
268 | | -type GenericWorkflowFunc[P any, R any] func(ctx context.Context, input P) (R, error) |
269 | | -``` |
| 269 | +## Documentation |
270 | 270 |
|
271 | | -To register a workflow call `dbos.RegisterWorkflow(dbosCtx, workflow)` after having initialized a DBOS Context. Workflows can only be registered before DBOS is launched. |
| 271 | +[https://docs.dbos.dev](https://docs.dbos.dev) |
272 | 272 |
|
| 273 | +## Examples |
273 | 274 |
|
274 | | -Workflows can run steps, which can be any function with the following signature: |
275 | | -```golang |
276 | | -type GenericStepFunc[R any] func(ctx context.Context) (R, error) |
277 | | -``` |
| 275 | +[https://docs.dbos.dev/examples](https://docs.dbos.dev/examples) |
278 | 276 |
|
279 | | -To run a step within a workflow, use `RunAsStep`. Importantly, you must pass to `RunAsStep` the context received in the workflow function (see examples above.) |
| 277 | +## DBOS vs. Other Systems |
280 | 278 |
|
281 | | -The input and output of workflows and steps are memoized in your Postgres database for workflow recovery. Under the hood, DBOS uses the [encoding/gob](https://pkg.go.dev/encoding/gob) package for serialization (this means that only exported fields will be memoized and types without exported fields will generate an error.) |
| 279 | +<details><summary><strong>DBOS vs. Temporal</strong></summary> |
282 | 280 |
|
283 | | -## Getting started |
| 281 | +#### |
284 | 282 |
|
285 | | -Install the DBOS Transact package in your program: |
| 283 | +Both DBOS and Temporal provide durable execution, but DBOS is implemented in a lightweight Postgres-backed library whereas Temporal is implemented in an externally orchestrated server. |
286 | 284 |
|
287 | | -```shell |
288 | | -go get github.com/dbos-inc/dbos-transact-golang |
289 | | -``` |
| 285 | +You can add DBOS to your program by installing this open-source library, connecting it to Postgres, and annotating workflows and steps. |
| 286 | +By contrast, to add Temporal to your program, you must rearchitect your program to move your workflows and steps (activities) to a Temporal worker, configure a Temporal server to orchestrate those workflows, and access your workflows only through a Temporal client. |
| 287 | +[This blog post](https://www.dbos.dev/blog/durable-execution-coding-comparison) makes the comparison in more detail. |
290 | 288 |
|
291 | | -You can store and export a Postgres connection string in the `DBOS_SYSTEM_DATABASE_URL` environment variable for DBOS to manage your workflows state. By default, DBOS will use `postgres://postgres:${PGPASSWORD}@localhost:5432/dbos?sslmode=disable`. |
| 289 | +**When to use DBOS:** You need to add durable workflows to your applications with minimal rearchitecting, or you are using Postgres. |
292 | 290 |
|
| 291 | +**When to use Temporal:** You don't want to add Postgres to your stack, or you need a language DBOS doesn't support yet. |
293 | 292 |
|
294 | | -## ⭐️ Like this project? |
| 293 | +</details> |
295 | 294 |
|
296 | | -[Star it on GitHub](https://github.com/dbos-inc/dbos-transact-golang) |
297 | | -[](https://github.com/dbos-inc/dbos-transact-golang) |
| 295 | +<details><summary><strong>DBOS vs. Airflow</strong></summary> |
| 296 | + |
| 297 | +#### |
| 298 | + |
| 299 | +DBOS and Airflow both provide workflow abstractions. |
| 300 | +Airflow is targeted at data science use cases, providing many out-of-the-box connectors but requiring workflows be written as explicit DAGs and externally orchestrating them from an Airflow cluster. |
| 301 | +Airflow is designed for batch operations and does not provide good performance for streaming or real-time use cases. |
| 302 | +DBOS is general-purpose, but is often used for data pipelines, allowing developers to write workflows as code and requiring no infrastructure except Postgres. |
| 303 | + |
| 304 | +**When to use DBOS:** You need the flexibility of writing workflows as code, or you need higher performance than Airflow is capable of (particularly for streaming or real-time use cases). |
| 305 | + |
| 306 | +**When to use Airflow:** You need Airflow's ecosystem of connectors. |
| 307 | + |
| 308 | +</details> |
| 309 | + |
| 310 | +<details><summary><strong>DBOS vs. Celery/BullMQ</strong></summary> |
| 311 | + |
| 312 | +#### |
| 313 | + |
| 314 | +DBOS provides a similar queue abstraction to dedicated queueing systems like Celery or BullMQ: you can declare queues, submit tasks to them, and control their flow with concurrency limits, rate limits, timeouts, prioritization, etc. |
| 315 | +However, DBOS queues are **durable and Postgres-backed** and integrate with durable workflows. |
| 316 | +For example, in DBOS you can write a durable workflow that enqueues a thousand tasks and waits for their results. |
| 317 | +DBOS checkpoints the workflow and each of its tasks in Postgres, guaranteeing that even if failures or interruptions occur, the tasks will complete and the workflow will collect their results. |
| 318 | +By contrast, Celery/BullMQ are Redis-backed and don't provide workflows, so they provide fewer guarantees but better performance. |
| 319 | + |
| 320 | +**When to use DBOS:** You need the reliability of enqueueing tasks from durable workflows. |
| 321 | + |
| 322 | +**When to use Celery/BullMQ**: You don't need durability, or you need very high throughput beyond what your Postgres server can support. |
| 323 | +</details> |
0 commit comments