pub struct MemoryPubsub { /* private fields */ }Expand description
In-process Pubsub impl.
Implementations§
Source§impl MemoryPubsub
impl MemoryPubsub
Sourcepub fn with_buffer_size(buffer: usize) -> Self
pub fn with_buffer_size(buffer: usize) -> Self
Build an empty pubsub with a custom per-channel buffer size.
Larger buffers tolerate slow subscribers; smaller buffers reject
fast publishers earlier (slow subscribers see
BusError::Retryable("subscriber lagged")).
Sourcepub async fn remove_subject(&self, pattern: &str)
pub async fn remove_subject(&self, pattern: &str)
Drop the broadcast channel for pattern. Used by
crate::request_reply::MemoryRequestReply to clean up the
short-lived _reply.{id} subjects it mints per RPC — without
this the per-pattern stores grow unbounded with one entry
per request.
Safe to call when no entry exists; behaves as a no-op. Removes from whichever store (concrete or wildcard) holds the entry.
Sourcepub async fn subject_count(&self) -> usize
pub async fn subject_count(&self) -> usize
Number of active subscription patterns currently retained across both concrete and wildcard stores. Test/observability helper; production callers should not rely on the exact value.
Trait Implementations§
Source§impl Clone for MemoryPubsub
impl Clone for MemoryPubsub
Source§fn clone(&self) -> MemoryPubsub
fn clone(&self) -> MemoryPubsub
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for MemoryPubsub
impl Default for MemoryPubsub
Source§impl Pubsub for MemoryPubsub
impl Pubsub for MemoryPubsub
Source§fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
payload: Bytes,
headers: Headers,
) -> Pin<Box<dyn Future<Output = Result<(), BusError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
payload: Bytes,
headers: Headers,
) -> Pin<Box<dyn Future<Output = Result<(), BusError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
payload on subject with headers.Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
_durable: DurableName,
) -> Pin<Box<dyn Future<Output = Result<MsgStream, BusError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
_durable: DurableName,
) -> Pin<Box<dyn Future<Output = Result<MsgStream, BusError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
durable form a competing-consumer group sharing replays.