Skip to main content

ConnectionConfigBuilder

Struct ConnectionConfigBuilder 

Source
pub struct ConnectionConfigBuilder { /* private fields */ }
Expand description

Builder for ConnectionConfig with fluent API

Implementations§

Source§

impl ConnectionConfigBuilder

Source

pub fn connect_timeout(self, timeout: Duration) -> ConnectionConfigBuilder

Set connection timeout

Source

pub fn read_timeout(self, timeout: Duration) -> ConnectionConfigBuilder

Set read timeout

Source

pub fn tls(self, tls: TlsConfig) -> ConnectionConfigBuilder

Replace the TLS config wholesale

Source

pub fn message_buffer(self, cap: usize) -> ConnectionConfigBuilder

Override the inbound message-channel capacity.

Defaults to DEFAULT_MESSAGE_BUFFER (4096). The channel uses drop-newest backpressure on saturation; tune this when the consumer can experience long pauses (e.g. trade peaks while a UI thread is blocked) or when subscribing to many high-volume symbols at once.

§Panics

Panics if cap is zero — a zero-capacity channel cannot make progress and is always a configuration mistake.

Source

pub fn event_buffer(self, cap: usize) -> ConnectionConfigBuilder

Override the lifecycle event-channel capacity.

Defaults to DEFAULT_EVENT_BUFFER (1024). Event volume is orders of magnitude lower than message volume; tune only if you retain raw events for an extended period without consuming them.

§Panics

Panics if cap is zero.

Source

pub fn client_id(self, id: impl Into<String>) -> ConnectionConfigBuilder

Set a low-cardinality identifier used as a client_id metric label when the metrics feature is enabled.

Cardinality: pass a deployment, instance, or service identifier (e.g. "monitor-stock-probe", "trader-prod-3"). Per-request UUIDs or any value derived from request data will explode Prometheus storage and break the metrics pipeline.

Length: values longer than CLIENT_ID_MAX_LEN are truncated to that many bytes; truncation emits tracing::warn! so the overflow is observable in operational logs.

Source

pub fn maybe_client_id( self, id: Option<impl Into<String>>, ) -> ConnectionConfigBuilder

Convenience for Option<impl Into<String>> callers (e.g. forwarding from a binding layer that may have an Option<String> in hand). Equivalent to client_id(...) when Some; no-op when None.

Source

pub fn build(self) -> ConnectionConfig

Build the configuration

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> 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> Same for T

Source§

type Output = T

Should always be Self
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