pub struct BatchConsumer { /* private fields */ }Expand description
Buffer events and upload them in batches to the ThinkingData receiver over HTTPS.
This is the Rust counterpart of the Go SDK’s TDBatchConsumer. When the
buffer reaches batch_size, or when cached batches exist, the next add
(or an explicit flush) triggers a delivery. Delivered batches are
dropped; undelivered batches stay in a bounded cache and are retried by
subsequent flushes.
Implementations§
Source§impl BatchConsumer
impl BatchConsumer
Sourcepub fn new(server_url: &str, app_id: &str) -> Result<Self>
pub fn new(server_url: &str, app_id: &str) -> Result<Self>
Create a batch consumer with default settings (gzip compression enabled, batch size 20).
Sourcepub fn with_batch_size(
server_url: &str,
app_id: &str,
batch_size: usize,
) -> Result<Self>
pub fn with_batch_size( server_url: &str, app_id: &str, batch_size: usize, ) -> Result<Self>
Create a batch consumer with an explicit batch size.
Sourcepub fn with_compress(
server_url: &str,
app_id: &str,
compress: bool,
) -> Result<Self>
pub fn with_compress( server_url: &str, app_id: &str, compress: bool, ) -> Result<Self>
Create a batch consumer with explicit compression control.
Sourcepub fn with_config(config: BatchConsumerConfig) -> Result<Self>
pub fn with_config(config: BatchConsumerConfig) -> Result<Self>
Create a batch consumer from a full configuration.
Sourcepub async fn flush_all_async(&self) -> Result<()>
pub async fn flush_all_async(&self) -> Result<()>
Deliver every currently pending batch.
Trait Implementations§
Source§impl Clone for BatchConsumer
impl Clone for BatchConsumer
Source§impl Consumer for BatchConsumer
Available on crate feature blocking only.
impl Consumer for BatchConsumer
blocking only.Source§fn add(&self, data: &Data) -> Result<()>
fn add(&self, data: &Data) -> Result<()>
Enqueue one event, blocking until a triggered delivery finishes.
Source§fn close(&self) -> Result<()>
fn close(&self) -> Result<()>
Stop admission, deliver every pending batch and shut down. Repeated calls return the same result.