pub struct BatchProcessor { /* private fields */ }Expand description
Batch processor that assembles messages into batches and processes them
Implementations§
Source§impl BatchProcessor
impl BatchProcessor
Sourcepub fn new(handler: Arc<dyn BatchHandler>, config: BatchConfig) -> Self
pub fn new(handler: Arc<dyn BatchHandler>, config: BatchConfig) -> Self
Create a new batch processor
Sourcepub async fn start(&mut self) -> WorkerResult<()>
pub async fn start(&mut self) -> WorkerResult<()>
Start the batch processor background task
Sourcepub async fn enqueue(&self, message: ReceivedMessage<Value>) -> WorkerResult<()>
pub async fn enqueue(&self, message: ReceivedMessage<Value>) -> WorkerResult<()>
Add a message to the batch queue
Sourcepub async fn shutdown(&self) -> WorkerResult<()>
pub async fn shutdown(&self) -> WorkerResult<()>
Shutdown the batch processor gracefully
Auto Trait Implementations§
impl !RefUnwindSafe for BatchProcessor
impl !UnwindSafe for BatchProcessor
impl Freeze for BatchProcessor
impl Send for BatchProcessor
impl Sync for BatchProcessor
impl Unpin for BatchProcessor
impl UnsafeUnpin for BatchProcessor
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