pub struct StreamBusOptions {
pub block_timeout: Duration,
pub claim_idle_timeout: Duration,
pub claim_scan_batch_size: usize,
pub group_start_id: String,
pub publish_batch_parallelism: usize,
pub ack_batch_size: usize,
pub ack_flush_interval: Duration,
pub reclaim_interval: Duration,
pub max_payload_bytes: usize,
pub error_observer: Option<Arc<dyn ErrorObserver>>,
}Fields§
§block_timeout: Duration§claim_idle_timeout: Duration§claim_scan_batch_size: usize§group_start_id: String§publish_batch_parallelism: usizeMaximum concurrent backend publish calls inside a single
publish_batch. Saturating the Redis connection pool gives diminishing
returns; 32 is a sensible default for MultiplexedConnection.
ack_batch_size: usizeMaximum number of ack IDs batched into a single XACK command.
ack_flush_interval: DurationMaximum time to wait after the first un-flushed ack before forcing a flush. Smaller values reduce ack latency; larger values amortize more round-trips.
reclaim_interval: DurationHow often the independent reclaim task checks for idle messages.
Decoupled from block_timeout so reclaim latency is predictable
regardless of read polling cadence.
max_payload_bytes: usizeHard cap on a single message’s payload, in bytes. Messages that exceed
this on publish are rejected with Validation; messages that exceed
this on receive are surfaced as Serialization and never reach the
handler. Set to 0 to disable the check (not recommended).
error_observer: Option<Arc<dyn ErrorObserver>>Observer for transient errors raised by the read / reclaim / ack-flush loops. Without one, errors are silently retried with backoff; with one, you can route them to metrics, tracing, or alerts. The hook is invoked from inside the loops and must not block.
Implementations§
Source§impl StreamBusOptions
impl StreamBusOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs options with all defaults. Equivalent to Default::default,
provided so callers can chain with_* methods without importing Default.
Sourcepub fn with_block_timeout(self, v: Duration) -> Self
pub fn with_block_timeout(self, v: Duration) -> Self
Sets the XREADGROUP BLOCK timeout.
Sourcepub fn with_claim_idle_timeout(self, v: Duration) -> Self
pub fn with_claim_idle_timeout(self, v: Duration) -> Self
Sets how long a pending entry must sit before XAUTOCLAIM reclaims it.
Sourcepub fn with_claim_scan_batch_size(self, v: usize) -> Self
pub fn with_claim_scan_batch_size(self, v: usize) -> Self
Sets the XAUTOCLAIM COUNT per scan.
Sourcepub fn with_group_start_id(self, v: impl Into<String>) -> Self
pub fn with_group_start_id(self, v: impl Into<String>) -> Self
Sets the consumer-group start id ($ = new only, 0 = from history).
Sourcepub fn with_publish_batch_parallelism(self, v: usize) -> Self
pub fn with_publish_batch_parallelism(self, v: usize) -> Self
Sets the cap on concurrent backend publish calls per publish_batch.
Sourcepub fn with_ack_batch_size(self, v: usize) -> Self
pub fn with_ack_batch_size(self, v: usize) -> Self
Sets the maximum number of ack ids per XACK command.
Sourcepub fn with_ack_flush_interval(self, v: Duration) -> Self
pub fn with_ack_flush_interval(self, v: Duration) -> Self
Sets the maximum delay before forcing a partial ack batch flush.
Sourcepub fn with_reclaim_interval(self, v: Duration) -> Self
pub fn with_reclaim_interval(self, v: Duration) -> Self
Sets how often the reclaim task scans for idle pending entries.
Sourcepub fn with_max_payload_bytes(self, v: usize) -> Self
pub fn with_max_payload_bytes(self, v: usize) -> Self
Sets the maximum payload size accepted by publish/publish_batch
and surfaced from incoming messages. 0 disables the check.
Sourcepub fn with_error_observer(self, observer: Arc<dyn ErrorObserver>) -> Self
pub fn with_error_observer(self, observer: Arc<dyn ErrorObserver>) -> Self
Installs an ErrorObserver for transient runtime errors.
Trait Implementations§
Source§impl Clone for StreamBusOptions
impl Clone for StreamBusOptions
Source§fn clone(&self) -> StreamBusOptions
fn clone(&self) -> StreamBusOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more