Rust

adapter

Module

Undocumented.

Contents

use utopia_queue::adapter::Adapter;
Rust
pub struct Adapter

The transport side of a worker server: its consumer (or a factory), how many workers run, the queue namespace, and the static resources.

use utopia_queue::adapter::Spec;
Rust
pub struct Spec

One queue to consume: identity, handler concurrency, prefetch and consumer.

use utopia_queue::adapter::Stopper;
Rust
pub struct Stopper(Arc<AtomicBool>)

Stops an Adapter's consume loops (Adapter::stopper).

use utopia_queue::adapter::Runtime;
Rust
pub enum Runtime

How the consume loops run.

Rust
pub type ConsumerFactory = Arc<dyn Fn(&str) -> Arc<dyn Consumer> + Send + Sync>

Makes a consumer for a queue name ('' for the adapter's own).

Rust
pub type ErrorCallback = Arc<dyn Fn(Option<Arc<Message>>, Error, Arc<Resources>) -> BoxFuture<'static, Result<()>> + Send + Sync>

Reports a failure: with the message, or None when obtaining one failed.

Rust
pub type MessageCallback = Arc<dyn Fn(Arc<Message>, Arc<Resources>) -> BoxFuture<'static, Result<()>> + Send + Sync>

Runs a message's handler; its result decides commit or reject.

Each callback gets the message's context: a child of the static resources, created per message and dropped once it is settled.

Rust
pub type SuccessCallback = Arc<dyn Fn(Arc<Message>, Arc<Resources>) -> BoxFuture<'static, Result<()>> + Send + Sync>

Runs after a message is committed.

Rust
pub const MAINTENANCE_INTERVAL: f64 = 30.0

Seconds between idle-upkeep sweeps of a running worker.

Rust
pub const RECEIVE_BACKOFF: u64 = 1

Seconds to wait after the broker failed to answer.

Rust
pub const RECEIVE_TIMEOUT: i64 = 2

Seconds a receive waits for the first message.