pub trait Backend:
Send
+ Sync
+ 'static {
// Required methods
fn declare<'life0, 'life1, 'async_trait>(
&'life0 self,
queues: &'life1 [QueueConfig],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
delay: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn defer<'life0, 'life1, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
delay: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn consume<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 QueueConfig,
) -> Pin<Box<dyn Future<Output = Result<DeliveryStream>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A transport. Implementations: MemoryBackend (this crate), RabbitMqBackend.
Required Methods§
Sourcefn declare<'life0, 'life1, 'async_trait>(
&'life0 self,
queues: &'life1 [QueueConfig],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn declare<'life0, 'life1, 'async_trait>(
&'life0 self,
queues: &'life1 [QueueConfig],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Idempotently create all queues (plus any retry / dead-letter infrastructure).
Sourcefn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
delay: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
delay: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish envelope to envelope.queue, optionally delayed.
Sourcefn defer<'life0, 'life1, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
delay: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn defer<'life0, 'life1, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
delay: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish envelope into a hold that releases it onto envelope.queue after
delay. This is the publish half of Delivery::defer, also used by
crate::Producer::defer.
Differs from publish with a delay only in intent, and backends may treat
the two differently in detail: a deferral is expected to carry its queue’s
top priority so it overtakes the backlog when it returns, and on RabbitMQ the
delay is rounded to a separate, typically finer, granularity because a
Retry-After is a contract while a backoff is a heuristic. Neither path
releases a job early, and neither lets different delays block each other.
Hold naming and lifetime are backend-specific.
Sourcefn consume<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 QueueConfig,
) -> Pin<Box<dyn Future<Output = Result<DeliveryStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn consume<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 QueueConfig,
) -> Pin<Box<dyn Future<Output = Result<DeliveryStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start consuming queue with the given prefetch. The stream ends when the
backend is closed or the connection is lost.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".