Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Kafka

Schemes: kafka://

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.

NameTypeRequiredDefaultDescription
consumer_optionsarray of array of anynonull(Consumer only) Additional librdkafka consumer configuration options (key-value pairs).
delayed_ackbooleannofalse(Publisher only) If true, do not wait for an acknowledgement when sending to broker. Defaults to false.
group_idstringno(Consumer only) Consumer group ID. If not provided, the consumer acts in Subscriber mode: it generates a unique, ephemeral group ID and starts consuming from the latest offset.
partition_keystringnonull(Publisher only) Name of a metadata field whose value is used as the Kafka record key (drives partitioning/ordering). Unset, or absent on a given message, falls back to the message id. Default unset.
partitionsintegerno6(Publisher only) Partition count used when auto-creating the topic (default: 6). Higher values raise write/consume parallelism; ordering is only guaranteed per partition key (message_id), not across the whole topic. Ignored if the topic exists.
passwordstringnoOptional password for SASL authentication.
producer_optionsarray of array of anynonull(Publisher only) Additional librdkafka producer configuration options (key-value pairs).
sharedbooleannotrue(Publisher only) Share one producer per connection (default: true); false gives a dedicated producer.
tlsobjectnosee belowTLS configuration.
topicstringnoThe Kafka topic to produce to or consume from.
urlstringyesComma-separated list of Kafka broker URLs. If it contains userinfo, it will be treated as a secret.
usernamestringnoOptional username for SASL 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()
};
NameTypeRequiredDefaultDescription
accept_invalid_certsbooleannofalseIf true, disable server certificate verification (insecure).
ca_filestringnoPath to the CA certificate file.
cert_filestringnoPath to the client certificate file (PEM).
cert_passwordstringnoPassword for the private key (if encrypted).
key_filestringnoPath to the client private key file (PEM).
requiredbooleannofalseIf true, enable TLS/SSL.