Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Work queues

Work queues require the default services feature. The queue-messenger and nats-queue backend features enable it automatically.

A work queue is a named queue of typed work items. You create or connect to a queue by name, and then you get a typed sender and a typed receiver for it.

use velo::queue::{backends::memory::InMemoryBackend, receiver, sender};

let backend = InMemoryBackend::new(1024);
let tx = sender::<Job>(&backend, "my-jobs").await?;
let rx = receiver::<Job>(&backend, "my-jobs").await?;

tx.enqueue(&Job { id: 1 }).await?;
let job = rx.next().await?.unwrap();
BackendFeatureDescription
InMemoryBackendservicesDashMap and flume channels. For tests.
MessengerQueueBackendqueue-messengerAn actor on a Velo instance, reached with active messages
NatsQueueBackendnats-queueNATS JetStream with WorkQueue retention