Database-Backed Queues (#654)
This PR introduces a new database-backed queue API, where queue
information is stored in the database. This enables dynamic queue
modification and makes queues more observable (for example, through the
client or dashboard).
This is not a breaking change. The old in-memory queue API remains fully
supported, but is now deprecated, and we recommend switching to
database-backed queues.
### Code Examples
Register a database-backed queue and enqueue work onto it:
```python
DBOS.register_queue("email", concurrency=10, limiter={"limit": 100, "period": 60})
@DBOS.workflow()
def send_email(to: str) -> None:
...
handle = DBOS.enqueue_workflow("email", send_email, "alice@example.com")
handle.get_result()
```
Retrieve and reconfigure a queue at runtime:
```py
queue = DBOS.retrieve_queue("email")
print(queue.concurrency) # 10 (read from DB)
queue.set_concurrency(50) # written to DB
queue.set_limiter({"limit": 500, "period": 60})
# Workers pick up the new config on their next poll iteration.
```
Manage queues from a client:
```py
client = DBOSClient(system_database_url="postgresql://...")
client.register_queue("email", concurrency=10)
client.enqueue({"queue_name": "email", "workflow_name": "send_email"}, "alice@example.com")
```
Fixes https://github.com/dbos-inc/dbos-transact-py/issues/586 P
Peter Kraft committed
834d4f8ce181a1e0fc73139b7c983eeb7f5d6b78
Parent: 0b59d6c
Committed by GitHub <noreply@github.com>
on 4/29/2026, 8:38:00 PM