pub struct KafkaTestSubscriber { /* private fields */ }Expand description
In-process subscriber on one topic name.
Yielded messages settle like the routing contract expects: ack finalizes, nack(true)
re-enqueues to this same subscription, nack(false) drops. The real transport’s
committed-position semantics (holes, watermarks, redelivery on rebalance) are deliberately
not simulated.
Implementations§
Trait Implementations§
Source§impl BatchSubscriber for KafkaTestSubscriber
impl BatchSubscriber for KafkaTestSubscriber
Source§fn batches(
&mut self,
) -> impl Stream<Item = Result<Self::Batch, <Self as Subscriber>::Error>> + Send + '_
fn batches( &mut self, ) -> impl Stream<Item = Result<Self::Batch, <Self as Subscriber>::Error>> + Send + '_
Streams non-empty pages natively: each waits for one delivery, then drains whatever else is already enqueued (mirroring the real subscriber’s drain-what-is-fetched behavior).
§Cancel safety
Same guarantees as Subscriber::stream: cancel safe between polls.
Source§type Batch = Vec<KafkaTestMessage>
type Batch = Vec<KafkaTestMessage>
Container yielded by
batches. Implementations choose between Vec, custom
iterators, or anything else that yields the underlying Subscriber::Message.Source§impl Debug for KafkaTestSubscriber
impl Debug for KafkaTestSubscriber
Source§impl Drop for KafkaTestSubscriber
impl Drop for KafkaTestSubscriber
Source§impl Subscriber for KafkaTestSubscriber
impl Subscriber for KafkaTestSubscriber
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 injected deliveries; never yields an error.
§Cancel safety
Cancel safe and re-enterable: the receiver is polled in place, so dropping the returned
stream loses nothing and stream can be called again.
Source§type Message = KafkaTestMessage
type Message = KafkaTestMessage
The message type yielded by this subscriber.
Source§type Error = KafkaError
type Error = KafkaError
The error type yielded by the stream when delivery fails.
Auto Trait Implementations§
impl Freeze for KafkaTestSubscriber
impl RefUnwindSafe for KafkaTestSubscriber
impl Send for KafkaTestSubscriber
impl Sync for KafkaTestSubscriber
impl Unpin for KafkaTestSubscriber
impl UnsafeUnpin for KafkaTestSubscriber
impl UnwindSafe for KafkaTestSubscriber
Blanket Implementations§
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
Mutably borrows from an owned value. Read more