boson-backend-postgres 0.1.1

PostgreSQL QueueBackend adapter for Boson
Documentation

boson-backend-postgres

PostgreSQL QueueBackend for Boson jobs and runs.

Role

Thin wrapper around boson-backend-sql-common SqlQueueBackend.

Compose

use std::sync::Arc;

use boson::{Boson, PostgresQueueBackend};

let backend = Arc::new(PostgresQueueBackend::connect("postgres://localhost/boson").await?);
let boson = Boson::builder()
    .queue_backend(backend)
    .execution_context_factory(your_factory)
    .build()?;

Bootstrap

use boson_backend_postgres::install_default_postgres_backend;
use boson_core::default_backend_from_global;

let _backend = install_default_postgres_backend("postgres://localhost/boson").await?;
let resolved = default_backend_from_global()?;

Isolated schema for parallel tests:

use boson_backend_postgres::install_isolated_postgres_backend;

let _backend = install_isolated_postgres_backend(url, "test_schema_1").await?;

Environment

Postgres URL resolution for tests: BOSON_TEST_POSTGRES_URL, then BOSON_BENCH_POSTGRES_URL.

Enable via boson

Available via the boson crate feature postgres.

Related crates