pub struct LapinSubscriber { /* private fields */ }Expand description
A consumer on one queue, yielding LapinMessage deliveries.
Created by subscribing a RabbitQueue descriptor (or a bare queue name)
through LapinBroker. The subscriber owns a dedicated channel;
dropping it closes that channel and the broker redelivers whatever was unacknowledged.
Back-pressure: the broker stops pushing once
prefetch unacknowledged deliveries are in flight, so
consuming slower slows the producer side down instead of buffering without bound.
It is a BatchSubscriber as well as a Subscriber: AMQP has no wire batch, so a batch
handler’s size is honoured by collecting the deliveries here (see the
impl).
Implementations§
Trait Implementations§
Source§impl BatchSubscriber for LapinSubscriber
Batches are assembled on the client: AMQP delivers one basic.deliver at a time, so there is
no wire batch to ask the broker for, and a batch closes on the registration’s size or on the
descriptor’s batch_wait, whichever comes first.
impl BatchSubscriber for LapinSubscriber
Batches are assembled on the client: AMQP delivers one basic.deliver at a time, so there is
no wire batch to ask the broker for, and a batch closes on the registration’s size or on the
descriptor’s batch_wait, whichever comes first.
A batch can only hold what the broker has already pushed, so a subscription whose
prefetch window is narrower than the registration’s batch size
yields batches capped by the window rather than by the size.
Source§fn batches(
&mut self,
size: NonZeroUsize,
) -> impl Stream<Item = Result<Self::Batch, <Self as Subscriber>::Error>> + Send + '_
fn batches( &mut self, size: NonZeroUsize, ) -> impl Stream<Item = Result<Self::Batch, <Self as Subscriber>::Error>> + Send + '_
Source§type Batch = Vec<LapinMessage>
type Batch = Vec<LapinMessage>
batches. Implementations choose between Vec, custom
iterators, or anything else that yields the underlying Subscriber::Message.Source§impl Debug for LapinSubscriber
impl Debug for LapinSubscriber
Source§impl Subscriber for LapinSubscriber
impl Subscriber for LapinSubscriber
Source§fn stream(
&mut self,
) -> impl Stream<Item = Result<Self::Message, Self::Error>> + Send + '_
fn stream( &mut self, ) -> impl Stream<Item = Result<Self::Message, Self::Error>> + Send + '_
Streams deliveries as they arrive; the stream ends when the consumer is cancelled or the connection closes.
§Cancel safety
Polling is cancel safe (no delivery is lost by dropping the stream between polls), and
the stream can be re-created by calling stream again: deliveries buffer in the
consumer, not in the returned stream.
Source§type Message = LapinMessage
type Message = LapinMessage
Auto Trait Implementations§
impl !RefUnwindSafe for LapinSubscriber
impl !UnwindSafe for LapinSubscriber
impl Freeze for LapinSubscriber
impl Send for LapinSubscriber
impl Sync for LapinSubscriber
impl Unpin for LapinSubscriber
impl UnsafeUnpin for LapinSubscriber
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more