pub struct ConnectionConfigBuilder { /* private fields */ }Expand description
Builder for ConnectionConfig with fluent API
Implementations§
Source§impl ConnectionConfigBuilder
impl ConnectionConfigBuilder
Sourcepub fn connect_timeout(self, timeout: Duration) -> ConnectionConfigBuilder
pub fn connect_timeout(self, timeout: Duration) -> ConnectionConfigBuilder
Set connection timeout
Sourcepub fn read_timeout(self, timeout: Duration) -> ConnectionConfigBuilder
pub fn read_timeout(self, timeout: Duration) -> ConnectionConfigBuilder
Set read timeout
Sourcepub fn tls(self, tls: TlsConfig) -> ConnectionConfigBuilder
pub fn tls(self, tls: TlsConfig) -> ConnectionConfigBuilder
Replace the TLS config wholesale
Sourcepub fn message_buffer(self, cap: usize) -> ConnectionConfigBuilder
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.
Sourcepub fn event_buffer(self, cap: usize) -> ConnectionConfigBuilder
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.
Sourcepub fn client_id(self, id: impl Into<String>) -> ConnectionConfigBuilder
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.
Sourcepub fn maybe_client_id(
self,
id: Option<impl Into<String>>,
) -> ConnectionConfigBuilder
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.
Sourcepub fn build(self) -> ConnectionConfig
pub fn build(self) -> ConnectionConfig
Build the configuration