Skip to main content

Configuration

A DBOS application is configured with a Config, and a client with a ClientConfig. Both are plain structs: build one with new or from_env, then set fields directly or with struct update syntax.

let mut config = dbos::Config::from_env("my-app");
config.app_version = Some(env!("CARGO_PKG_VERSION").to_owned());
config.max_connections = 20;
let dbos = dbos::DBOS::new(config);

Config​

Config::new(app_name, database_url) builds a configuration with the defaults below. Config::from_env(app_name) does the same, taking the database URL from the DBOS_SYSTEM_DATABASE_URL environment variable; if it's unset, the URL is left empty and launch reports it.

FieldDefaultDescription
app_name(required)The application's name. It identifies the application's rows among those sharing the system database: 3 to 256 lowercase letters, digits, dashes and underscores.
database_url(required)The system database's Postgres connection URL. DBOS creates the database if it doesn't exist.
app_versionNoneThe application version. Recovery resumes only the workflows started on the running version. DBOS doesn't compute one: if this is None, launch takes DBOS__APPVERSION, and fails if that is unset too. See versioning.
executor_idNoneThis process's ID among the executors sharing the database. If None, DBOS__VMID, then "local".
max_connections10The connection pool's size.
schema"dbos"The Postgres schema that holds the DBOS tables. Every application sharing the database must use the same one.
migratetrueWhether launch creates and migrates the DBOS tables. Turn it off when a deployment step migrates the database, for example with dbosctl sysdb migrate.
serializerrust_serdeHow payloads are encoded by default. See serialization.
use_listen_notifytrueWhether to wake waiting calls (recv, get_event, stream reads) with Postgres LISTEN/NOTIFY rather than polling alone. Queues are always polled. CockroachDB has no LISTEN/NOTIFY, so DBOS polls there whatever this says.
listen_queuesNoneThe queues this process dequeues from; None is all of them, and Some(vec![]) none of them. DBOS's internal queue, where resumed, forked and recovered workflows run, is always dequeued. See listening to specific queues.
polling_concurrencyhalf the poolHow many polling reads may run at once. A PollingConcurrency: Default, Unlimited or AtMost(n).
outcome_poll_interval1 secondHow often a caller waiting on a workflow another process runs checks whether it has finished. Zero is refused.
notification_coalesce10 millisecondsHow long a write waits for others before DBOS sends a wakeup for it. Zero turns coalescing off.
idle_transaction_timeout60 secondsHow long a system-database connection may sit idle in an open transaction before Postgres ends its session. An IdleTransactionTimeout: Default, ServerSetting or After(duration).
scheduler_polling_interval30 secondsHow often the scheduler re-reads the schedules table. For the first minute after launch it looks every second. Zero is refused.

Environment Variables​

VariableRead byDescription
DBOS_SYSTEM_DATABASE_URLConfig::from_env, ClientConfig::from_envThe system database URL.
DBOS__APPVERSIONlaunchThe application version, when app_version is None.
DBOS__VMIDlaunchThe executor ID, when executor_id is None.
PGUSER, PGPASSWORD, and the other libpq variablesthe Postgres driverFill in whatever the connection URL leaves out.

DBOS logs through tracing, so its log level is whatever your subscriber sets, for example with RUST_LOG and tracing_subscriber::EnvFilter.

ClientConfig​

ClientConfig::new(database_url) and ClientConfig::from_env() build a client's configuration. A client runs no workflows, so it has fewer settings:

FieldDefaultDescription
database_url(required)The system database's connection URL.
app_nameNoneThe application the client acts for. Named, the rows the client writes belong to that application and its searches are scoped to it. None writes unclaimed rows, which any application sharing the database may run, and reads across all applications. Set it whenever several applications share a system database. from_env never sets it.
max_connections5The connection pool's size.
schema"dbos"Must match the application's.
serializerrust_serdeHow the client encodes what it writes. To read a custom serializer's rows, configure the same serializer.
use_listen_notifyfalseWhether get_event and stream reads are woken by LISTEN/NOTIFY. Turn it on only when the application's executors have use_listen_notify on, since they send the notifications. Waits on a workflow's result always poll.
polling_concurrency, outcome_poll_interval, notification_coalesce, idle_transaction_timeoutas for ConfigAs for Config.