boson (uf-boson on crates.io)
Main crate — re-exports core types, runtime, optional backends, and the #[task] macro.
The crates.io package is uf-boson (boson is already taken). With [lib] name = "boson",
imports stay use boson::….
Source of truth: cargo doc -p uf-boson --features mem,axum --open — guided get-started with
Mode 1 (embedded) and
Mode 2 (remote worker).
Published docs: https://docs.rs/uf-boson
Role
task—#[task]macro and typedsend_withBoson/BosonBuilder— worker boot- Feature-gated backends:
mem,sqlite,postgres,axum,telemetry-console - Fleet backends:
boson-backend-redis,boson-backend-nats prelude— common re-exports
Cargo features
| Feature | Enables |
|---|---|
mem |
MemQueueBackend and bootstrap helpers |
sqlite |
SqliteQueueBackend and bootstrap helpers |
postgres |
PostgresQueueBackend and bootstrap helpers |
telemetry-console |
ConsoleOpsLog (always available via re-export) |
axum |
HTTP admin router and state types |
This crate ships with no default features (default = []).
Boot a worker (Mode 1)
[]
= { = "uf-boson", = "0.1.1", = ["mem"] }
= { = "1", = ["rt-multi-thread", "macros"] }
use Arc;
use ;
async
let boson = builder
.queue_backend
.execution_context_factory
.auto_registry
.build?;
configure;
With HTTP admin: features = ["mem", "axum"]. Full walkthrough: crate rustdoc Getting started and
task_macro.
Mode 2 (enqueue host + worker): remote_enqueue / remote_worker examples (--features sqlite).
Define handlers and enqueue
After boot, add handlers with #[task] and enqueue with <TaskName>::send_with(...). See
boson-macros for policy attributes.
Configuration precedence
| Layer | Resolution order |
|---|---|
| Worker settings | BosonBuilder field → env var → default |
| Task config at enqueue | Persisted backend config → macro/descriptor defaults |
| Idempotency mode | Per-task override → runtime builder default |
| Queue backend | Explicit queue_backend() → global router |
| Ops log | Builder ops_log() → NoOpsLog; or ops_log_from_env() |
| Fleet URLs (Redis/NATS) | BOSON_*_POOL_ROUTING → BOSON_*_URLS |
Related crates
boson-macros—#[boson::task]proc macroboson-runtime— worker runtime and builderboson-core— shared types andQueueBackendtraitboson-axum— HTTP admin API