pub struct NatsConfig {Show 15 fields
pub url: String,
pub subject: Option<String>,
pub stream: Option<String>,
pub username: Option<String>,
pub password: Option<String>,
pub tls: TlsConfig,
pub token: Option<String>,
pub request_reply: bool,
pub request_timeout_ms: Option<u64>,
pub delayed_ack: bool,
pub no_jetstream: bool,
pub subscriber_mode: bool,
pub stream_max_messages: Option<i64>,
pub stream_max_bytes: Option<i64>,
pub prefetch_count: Option<usize>,
}Expand description
General NATS connection configuration.
Fields§
§url: StringComma-separated list of NATS server URLs (e.g., “nats://localhost:4222,nats://localhost:4223”).
subject: Option<String>The NATS subject to publish to or subscribe to.
stream: Option<String>(Consumer only). The JetStream stream name. Required for Consumers.
username: Option<String>Optional username for authentication.
password: Option<String>Optional password for authentication.
tls: TlsConfigTLS configuration.
token: Option<String>Optional token for authentication.
request_reply: bool(Publisher only) If true, the publisher uses the request-reply pattern.
It sends a request and waits for a response (using core_client.request_with_headers()).
Defaults to false.
request_timeout_ms: Option<u64>(Publisher only) Timeout for request-reply operations in milliseconds. Defaults to 30000ms.
delayed_ack: bool(Publisher only) If true, do not wait for an acknowledgement when sending to broker. Defaults to false.
no_jetstream: boolIf no_jetstream: true, use Core NATS (fire-and-forget) instead of JetStream. Defaults to false.
subscriber_mode: bool(Consumer only) If true, use ephemeral Subscriber mode. Defaults to false (durable consumer).
stream_max_messages: Option<i64>(Publisher only) Maximum number of messages in the stream (if created by the bridge). Defaults to 1,000,000.
stream_max_bytes: Option<i64>(Publisher only) Maximum total bytes in the stream (if created by the bridge). Defaults to 1GB.
prefetch_count: Option<usize>(Consumer only) Number of messages to prefetch from the consumer. Defaults to 10000.
Trait Implementations§
Source§impl Clone for NatsConfig
impl Clone for NatsConfig
Source§fn clone(&self) -> NatsConfig
fn clone(&self) -> NatsConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more