Skip to main content

Crate queuey_core

Crate queuey_core 

Source
Expand description

Core abstractions for queuey.

This crate is transport-agnostic. It defines:

  • QueueSet: implemented (usually via #[derive(Queues)]) by an enum whose variants are the queues of an application.
  • Job: implemented (usually via #[derive(Job)]) by a serializable payload type. A job statically knows which queue (variant) it belongs to.
  • JobHandler: user code that processes one job type.
  • Backend: a message transport (RabbitMQ, in-memory, …).
  • Producer / Worker: the runtime that ties everything together.
  • RetryPolicy / Backoff: optional (exponential) retry configuration.
  • Deferral: a handler returns JobError::Deferred (or a producer calls Producer::defer) to park a job for an exact delay and have it come back ahead of the backlog, at QueueConfig::max_priority, without spending an attempt. The motivating case is an API answering 429 with Retry-After.

Module structure and public API below is the contract shared by the macro crate and the backend crates. Keep signatures stable; extend rather than change.

Re-exports§

pub use backend::Backend;
pub use backend::Delivery;
pub use backend::DeliveryStream;
pub use envelope::Envelope;
pub use error::Error;
pub use error::JobError;
pub use error::Result;
pub use handler::FnHandler;
pub use handler::JobContext;
pub use handler::JobHandler;
pub use job::Job;
pub use memory::MemoryBackend;
pub use producer::Producer;
pub use queue::DEFAULT_MAX_PRIORITY;
pub use queue::QueueConfig;
pub use queue::QueueSet;
pub use retry::Backoff;
pub use retry::RetryDecision;
pub use retry::RetryPolicy;
pub use worker::Worker;
pub use worker::WorkerBuilder;
pub use worker::WorkerHandle;

Modules§

backend
Transport abstraction: Backend, Delivery and DeliveryStream.
envelope
The Envelope: the wire format every job travels in.
error
Error types: Error for infrastructure, JobError for handlers.
handler
JobHandler, the JobContext it receives and the FnHandler adapter.
job
The Job trait: a serializable payload bound to one queue.
memory
In-memory backend for tests and local development.
producer
The Producer: type-safe publishing into a queue set.
queue
Queue declarations: QueueSet and QueueConfig.
retry
Retry configuration: RetryPolicy, Backoff and the backoff math.
worker
Worker runtime.