pub struct MessageBatcher { /* private fields */ }Expand description
Message batcher for high-throughput publishing
Implementations§
Source§impl MessageBatcher
impl MessageBatcher
Sourcepub async fn new(publisher: Publisher, config: BatchConfig) -> Result<Self>
pub async fn new(publisher: Publisher, config: BatchConfig) -> Result<Self>
Create a new message batcher
Sourcepub async fn with_metrics(
publisher: Publisher,
config: BatchConfig,
metrics: RustRabbitMetrics,
) -> Result<Self>
pub async fn with_metrics( publisher: Publisher, config: BatchConfig, metrics: RustRabbitMetrics, ) -> Result<Self>
Create a new message batcher with metrics
Sourcepub async fn queue_message<T>(
&self,
queue_name: &str,
message: &T,
options: Option<PublishOptions>,
) -> Result<()>where
T: Serialize,
pub async fn queue_message<T>(
&self,
queue_name: &str,
message: &T,
options: Option<PublishOptions>,
) -> Result<()>where
T: Serialize,
Add a message to the batch queue
Sourcepub fn is_nearly_full(&self) -> bool
pub fn is_nearly_full(&self) -> bool
Check if the batch queue is nearly full
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageBatcher
impl !RefUnwindSafe for MessageBatcher
impl Send for MessageBatcher
impl Sync for MessageBatcher
impl Unpin for MessageBatcher
impl !UnwindSafe for MessageBatcher
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
Mutably borrows from an owned value. Read more