NATS
Schemes: nats://
Query parameters recognised as config fields for this connector. The object-typed tls is set with a JSON literal, e.g. ?tls={...}. Unrecognised parameters are not forwarded as driver options, so any other ?key=value pair is rejected rather than silently ignored.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
deduplicate | boolean | no | false | (Publisher only, JetStream) If true, publish a Nats-Msg-Id header (from the message id) so JetStream deduplicates redeliveries within the stream’s duplicate window. Defaults to false. |
delayed_ack | boolean | no | false | (Publisher only) If true, do not wait for an acknowledgement when sending to broker. Defaults to false. |
deliver_policy | all | last | new | last_per_subject | no | — | (Consumer only) The delivery policy for the consumer. Defaults to “all”. |
no_jetstream | boolean | no | false | If no_jetstream: true, use Core NATS (fire-and-forget) instead of JetStream. Defaults to false. |
password | string | no | — | Optional password for authentication. |
prefetch_count | integer | no | — | (Consumer only) Number of messages to prefetch from the consumer. Defaults to 10000. |
request_reply | boolean | no | false | (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 | integer | no | — | (Publisher only) Timeout for request-reply operations in milliseconds. Defaults to 30000ms. |
shared | boolean | no | true | Share one NATS client per connection (default: true); false forces a dedicated connection. |
stream | string | no | — | The JetStream stream name. Required for Consumers, even with no_jetstream: true (unused there, but still validated). |
stream_max_bytes | integer | no | — | (Publisher only) Maximum total bytes in the stream (if created by the bridge). Defaults to 1GB. |
stream_max_messages | integer | no | — | (Publisher only) Maximum number of messages in the stream (if created by the bridge). Defaults to 1,000,000. |
subject | string | no | — | The NATS subject to publish to or subscribe to. If a stream is auto-created, it’s scoped to {stream}.>, so prefix accordingly. |
subscriber_mode | boolean | no | false | (Consumer only) If true, use ephemeral Subscriber mode. Defaults to false (durable consumer). |
tls | object | no | see below | TLS configuration. |
token | string | no | — | Optional token for authentication. |
url | string | yes | — | Comma-separated list of NATS server URLs (e.g., “nats://localhost:4222,nats://localhost:4223”). If it contains userinfo, it will be treated as a secret. |
username | string | no | — | Optional username for authentication. |
Struct-typed fields
tls
TLS configuration for secure connections.
Configures Transport Layer Security (TLS/SSL) for encrypted communication. Supports both client certificate (mutual TLS) and server certificate validation.
Examples
use mq_bridge::models::TlsConfig;
let tls = TlsConfig {
required: true,
ca_file: Some("/path/to/ca.pem".to_string()),
cert_file: Some("/path/to/cert.pem".to_string()),
key_file: Some("/path/to/key.pem".to_string()),
..Default::default()
};
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
accept_invalid_certs | boolean | no | false | If true, disable server certificate verification (insecure). |
ca_file | string | no | — | Path to the CA certificate file. |
cert_file | string | no | — | Path to the client certificate file (PEM). |
cert_password | string | no | — | Password for the private key (if encrypted). |
key_file | string | no | — | Path to the client private key file (PEM). |
required | boolean | no | false | If true, enable TLS/SSL. |