Skip to main content

QueueName

Trait QueueName 

Source
pub trait QueueName: 'static {
    type Job: Job;

    const NAME: &'static str;
}
Expand description

The type-level identity of a queue: its wire name plus the Job payload it carries. Implemented by the queue macro on a unit struct living beside the payload at the feature port:

use nest_rs_queue::{queue, QueueName};

// Any `T: Serialize + DeserializeOwned + Clone + Send + Sync + Unpin` is a
// `Job`; a real feature uses its own `TranscodeCommand` payload struct.
#[queue(name = "transcode", job = String)]
struct TranscodeQueue;

assert_eq!(<TranscodeQueue as QueueName>::NAME, "transcode");

Both sides then name the type, not the string: push_to on the producer and #[process(queue = TranscodeQueue)] on the consumer. The macro asserts the process method’s job argument is Self::Job, so a mismatch is a compile error naming both types.

Required Associated Constants§

Source

const NAME: &'static str

The wire name apalis (or any backend) namespaces storage under — the exact string a legacy #[process(queue = "…")] literal would carry.

Required Associated Types§

Source

type Job: Job

The payload type pushed onto and drained off this queue. The producer’s push_to::<Self> accepts exactly this type; the consumer’s #[process(queue = Self)] method must receive exactly this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§