1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Backend + producer seams.
//!
//! Every queue backend implements [`QueueBackend`] (the boot identity used by
//! diagnostics) and exposes a [`JobProducer`] surface so any feature can
//! enqueue without naming the backend. The first-class backend is `apalis-redis`
//! (shipped as `nestrs-queue`); third-party backends provide their own
//! `*Module` that registers a `JobProducer` in the container the same way.
use async_trait;
use Serialize;
use crateJob;
/// A queue backend, identified by name for boot diagnostics. The actual
/// runtime work happens through [`JobProducer`] (enqueue) and
/// [`JobConsumer`](crate::consumer::JobConsumer) (drain `ProcessMethod` and
/// dispatch). A backend's module typically:
///
/// 1. seeds an `Arc<dyn JobProducer>` in the container (so any service can
/// inject it generically), and
/// 2. contributes a `Transport` whose `serve` runs the backend's
/// [`JobConsumer`] driver.
/// Backend-agnostic producer: push a JSON-serialized job onto a named queue.
/// Concrete backends implement this; typed pushes are a convenience built on
/// top via [`JobProducerExt`].
/// Typed-push convenience over any [`JobProducer`]. Lives as an extension trait
/// so the producer trait stays object-safe (`Arc<dyn JobProducer>`).