Skip to main content

StreamBusOptions

Struct StreamBusOptions 

Source
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: usize

Maximum 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: usize

Maximum number of ack IDs batched into a single XACK command.

§ack_flush_interval: Duration

Maximum 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: Duration

How 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: usize

Hard 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

Source

pub fn new() -> Self

Constructs options with all defaults. Equivalent to Default::default, provided so callers can chain with_* methods without importing Default.

Source

pub fn with_block_timeout(self, v: Duration) -> Self

Sets the XREADGROUP BLOCK timeout.

Source

pub fn with_claim_idle_timeout(self, v: Duration) -> Self

Sets how long a pending entry must sit before XAUTOCLAIM reclaims it.

Source

pub fn with_claim_scan_batch_size(self, v: usize) -> Self

Sets the XAUTOCLAIM COUNT per scan.

Source

pub fn with_group_start_id(self, v: impl Into<String>) -> Self

Sets the consumer-group start id ($ = new only, 0 = from history).

Source

pub fn with_publish_batch_parallelism(self, v: usize) -> Self

Sets the cap on concurrent backend publish calls per publish_batch.

Source

pub fn with_ack_batch_size(self, v: usize) -> Self

Sets the maximum number of ack ids per XACK command.

Source

pub fn with_ack_flush_interval(self, v: Duration) -> Self

Sets the maximum delay before forcing a partial ack batch flush.

Source

pub fn with_reclaim_interval(self, v: Duration) -> Self

Sets how often the reclaim task scans for idle pending entries.

Source

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.

Source

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

Source§

fn clone(&self) -> StreamBusOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamBusOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StreamBusOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V