kafka-rust

rustfs-kafka-async

Rust crates.io docs.rs License Crates.io

Async wrappers for rustfs-kafka, built on top of tokio.

This crate provides:

The current implementation uses native tokio async I/O for metadata, produce/fetch, and commit request paths.

Security flow supports TLS and SASL authentication in native async mode, including PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512.

Installation

[dependencies]
rustfs-kafka-async = "1.2.0"

Quick Example

use rustfs_kafka::producer::Record;
use rustfs_kafka_async::AsyncProducer;

#[tokio::main]
async fn main() -> rustfs_kafka::Result<()> {
    let producer = AsyncProducer::builder(vec!["localhost:9092".to_owned()])
        .with_client_id("example-async-producer".to_owned())
        .build()
        .await?;
    producer.send(&Record::from_value("my-topic", b"hello async")).await?;
    producer.flush().await?;
    producer.close().await?;
    Ok(())
}

Notes