Module kafka

Module kafka 

Source
Expand description

§Kafka Producer Module

This module provides a high-level Rust API for creating and configuring Kafka producers. It wraps the lower-level WIT (WebAssembly Interface Types) bindings to offer a more ergonomic interface for publishing messages to Kafka topics.

§Quick Start


// Create a basic producer configuration
let config = KafkaProducerConfig::default();

// Connect to Kafka
let producer = kafka::producer(
    "my-producer",
    ["localhost:9092"],
    "my-topic",
    config
)?;

§Authentication

The module supports multiple authentication methods:

  • SASL/PLAIN: Username and password authentication
  • SASL/SCRAM: SHA256 and SHA512 SCRAM mechanisms
  • mTLS: Mutual TLS with client certificates

§TLS Configuration

TLS connections can be configured to use either the system’s certificate authority store or a custom CA certificate file.

Structs§

KafkaAuthentication
Authentication configuration for Kafka connections.
KafkaBatchConfig
Configuration options for Kafka message batching.
KafkaConsumer
A Kafka consumer that can receive messages from Kafka topics.
KafkaConsumerConfig
Configuration for a Kafka consumer.
KafkaMessage
A Kafka message containing key, value, headers, and metadata.
KafkaProducer
A Kafka producer client for publishing messages to Kafka topics.
KafkaProducerConfig
Configuration options for a Kafka producer.

Enums§

KafkaProducerCompression
Compression algorithms available for Kafka message batches.
KafkaTlsConfig
TLS configuration options for Kafka connections.

Functions§

consumer
Connects to Kafka servers and creates a new Kafka consumer.
producer
Connects to Kafka servers and creates a new Kafka producer.