pub struct KafkaConfig {
pub endpoint: String,
pub default_topic: String,
pub client_id: String,
pub acks: String,
pub timeout_ms: u64,
pub compression: Option<String>,
}Expand description
Kafka transport adapter configuration.
Fields§
§endpoint: StringThe broker endpoint, scheme first: kafka+ssl://host:port,
kafka+sasl-ssl://host:port, or kafka://host:port for a development broker
under FRAISEQL_KAFKA_ALLOW_PLAINTEXT.
A bare bootstrap.servers list is refused rather than defaulted (#1102). This
adapter ships entity after-images and pre-images, and librdkafka reads a
scheme-less list as PLAINTEXT — which is what it did here, with no
security.protocol set at all, until the endpoint was screened by
fraiseql_guard::kafka.
default_topic: StringDefault topic for events (can be overridden per subscription).
client_id: StringClient ID for Kafka producer.
acks: StringMessage acknowledgment mode (“all”, “1”, “0”).
timeout_ms: u64Message timeout in milliseconds.
compression: Option<String>Enable message compression.
Implementations§
Source§impl KafkaConfig
impl KafkaConfig
Sourcepub fn new(
endpoint: impl Into<String>,
default_topic: impl Into<String>,
) -> Self
pub fn new( endpoint: impl Into<String>, default_topic: impl Into<String>, ) -> Self
Create a new Kafka configuration.
endpoint must carry a scheme — see KafkaConfig::endpoint. It is not
validated here: the refusal happens at KafkaAdapter::new, where it can be
reported to whoever is mounting the transport.
The default timeout_ms is 5 s rather than the CDC sink’s 30 s. Subscription
delivery is at-most-once with no outbox behind it, so a delivery attempt is a
hot-path task with nothing to retry it — parking one for half a minute over a
message nobody will resend is the wrong trade.
Sourcepub fn with_client_id(self, client_id: impl Into<String>) -> Self
pub fn with_client_id(self, client_id: impl Into<String>) -> Self
Set the client ID.
Sourcepub const fn with_timeout(self, timeout_ms: u64) -> Self
pub const fn with_timeout(self, timeout_ms: u64) -> Self
Set message timeout.
Sourcepub fn with_compression(self, compression: impl Into<String>) -> Self
pub fn with_compression(self, compression: impl Into<String>) -> Self
Enable compression (e.g., “gzip”, “snappy”, “lz4”).