pub struct InMemoryConsumer { /* private fields */ }Expand description
In-memory stream consumer for testing the bridge without external dependencies.
Implementations§
Source§impl InMemoryConsumer
impl InMemoryConsumer
Sourcepub fn new(messages: Vec<StreamMessage>) -> Self
pub fn new(messages: Vec<StreamMessage>) -> Self
Create a new in-memory consumer with pre-loaded messages.
Sourcepub fn produce(&mut self, source: &str, key: Option<&[u8]>, payload: &[u8])
pub fn produce(&mut self, source: &str, key: Option<&[u8]>, payload: &[u8])
Add a message to the stream.
Sourcepub fn committed_offsets(&self) -> &[StreamOffset]
pub fn committed_offsets(&self) -> &[StreamOffset]
Get committed offsets.
Trait Implementations§
Source§impl StreamConsumer for InMemoryConsumer
impl StreamConsumer for InMemoryConsumer
Source§fn subscribe(&mut self, sources: &[&str]) -> Result<(), StreamError>
fn subscribe(&mut self, sources: &[&str]) -> Result<(), StreamError>
Subscribe to topics/subjects/streams.
Source§fn poll(&mut self, max: usize) -> Result<Vec<StreamMessage>, StreamError>
fn poll(&mut self, max: usize) -> Result<Vec<StreamMessage>, StreamError>
Poll for new messages (non-blocking). Read more
Source§fn commit(&mut self, offset: &StreamOffset) -> Result<(), StreamError>
fn commit(&mut self, offset: &StreamOffset) -> Result<(), StreamError>
Commit offset (acknowledge processing).
Source§fn disconnect(&mut self) -> Result<(), StreamError>
fn disconnect(&mut self) -> Result<(), StreamError>
Disconnect from the stream source.
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if connected.
Source§fn metrics(&self) -> StreamConsumerMetrics
fn metrics(&self) -> StreamConsumerMetrics
Get consumer metrics.
Auto Trait Implementations§
impl Freeze for InMemoryConsumer
impl RefUnwindSafe for InMemoryConsumer
impl Send for InMemoryConsumer
impl Sync for InMemoryConsumer
impl Unpin for InMemoryConsumer
impl UnsafeUnpin for InMemoryConsumer
impl UnwindSafe for InMemoryConsumer
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.