Install
-
Add the dependencies.
Cargo.toml [dependencies]queuey = "0.2"serde = { version = "1", features = ["derive"] }tokio = { version = "1", features = ["rt-multi-thread", "macros"] } -
Import the prelude. One
usebrings in the derives, the traits they implement, the runtime and the handful of foreign items your code cannot avoid naming.use queuey::prelude::*; -
Check your toolchain. queuey needs Rust 1.88 or newer and builds on edition 2024.
Terminal window rustc --version
Feature flags
Section titled “Feature flags”There is one, on the facade crate:
| Feature | Default | Effect |
|---|---|---|
rabbitmq |
yes | Pulls in queuey-rabbitmq and re-exports RabbitMqBackend, RabbitMqOptions and the rabbitmq module |
Turning it off leaves the core, the macros and MemoryBackend, which is enough
for tests or for a backend of your own:
[dependencies]queuey = { version = "0.2", default-features = false }What the prelude brings in
Section titled “What the prelude brings in”use queuey::prelude::* gives you:
- the two derives,
QueuesandJob; - the traits they implement,
QueueSetandJob; - the runtime:
Producer,Worker,WorkerBuilder,WorkerHandle,JobHandler,FnHandler,JobContext,JobError; - the configuration types:
QueueConfig,RetryPolicy,Backoff,DEFAULT_MAX_PRIORITY; MemoryBackend, andRabbitMqBackendwhen the feature is on;- the three foreign items user code cannot avoid naming:
async_trait,SerializeandDeserialize, andArc.
Items the prelude leaves out, because most code never names them, are still
available from the crate root: Error, Result, Envelope, RetryDecision,
Backend, Delivery, DeliveryStream.
The workspace
Section titled “The workspace”You only ever depend on queuey. The derives resolve their own paths through
the facade, so there is no crate = "..." attribute to write and no direct
dependency on the core crate.
| Crate | Role | API docs |
|---|---|---|
queuey |
Facade: prelude, re-exports, examples | docs.rs |
queuey-core |
Traits, Producer, Worker, retry policies, MemoryBackend |
docs.rs |
queuey-macros |
#[derive(Queues)], #[derive(Job)] |
docs.rs |
queuey-rabbitmq |
RabbitMqBackend on lapin |
docs.rs |
A broker to develop against
Section titled “A broker to develop against”The RabbitMQ backend talks to any 3.x or 4.x broker. For local work:
docker run --rm -d -p 5672:5672 -p 15672:15672 rabbitmq:4-managementThe management UI is then on http://localhost:15672 with guest / guest,
which is worth having open the first time you watch retries and hold queues
appear.
You do not need it to get started: MemoryBackend
runs the same code with no broker at all.