boson-runtime 0.1.1

Boson worker engine, builder, and enqueue orchestration
Documentation

boson-runtime

Worker runtime, builder, and enqueue orchestration.

Wire the worker (or enqueue-only host) process here once; task authors add handlers via boson-macros without repeating boot steps.

Topology (embedded vs remote): see boson Getting started.

Role

  • Boson / BosonBuilder — inject QueueBackend, identity factory, and OpsLog
  • Background worker loop with lease-based claim and dispatch
  • configure / default — process-wide default required for macro send_with (once at boot)
  • TaskRegistry — auto-discovery via auto_registry or manual registration in tests

Boot with #[task] (Mode 1 — once per process)

use std::sync::Arc;

use boson_core::JsonExecutionContextFactory;
use boson_backend_mem::MemQueueBackend;
use boson_runtime::{configure, Boson};

let boson = Boson::builder()
    .queue_backend(Arc::new(MemQueueBackend::new()))
    .execution_context_factory(JsonExecutionContextFactory)
    .auto_registry()
    .build()?;
configure(boson);

Link every crate that defines #[boson::task] handlers into the worker binary. See boson Mode 1 / Mode 2 and task_macro.

Manual task registration (tests)

use boson_runtime::{TaskDescriptor, TaskRegistry};

let mut registry = TaskRegistry::new();
let desc: &'static TaskDescriptor = Box::leak(Box::new(TaskDescriptor::new("my_task", invoke_fn)));
registry.register(desc);

Related crates