rust-rdkafka

crates.io docs.rs Build Status Join the chat at https://gitter.im/rust-rdkafka/Lobby

Kafka client library for Rust based on [librdkafka].

The library

This library aims to provide a safe interface to librdkafka. It currently exports some of the funcionalities provided by the producer and consumer of librdkafka 0.9.2.

Producers and consumers can be accessed and polled directly, or alternatively a [futures]-based interface can be used:

Warning: this library is still at an early development stage, the API is very likely to change and it shouldn't be considered production ready.

Installation

Add this to your Cargo.toml:

toml [dependencies] rdkafka = "^0.2.0"

This crate will compile librdkafka from sources and link it statically in your executable. To compile librdkafka you'll need:

To enable ssl and sasl, use the features field in Cargo.toml. Example:

toml [dependencies.rdkafka] version = "^0.3.0" features = ["ssl", "sasl"]

Compiling from sources

To compile from sources, you'll have to update the submodule containing librdkafka:

bash git submodule update --init

and then compile using cargo, selecting the features that you want. Example:

bash cargo build --features "ssl sasl"

Examples

You can find examples in the examples folder. To run them:

bash cargo run --example <example_name> -- <example_args>

Documentation

Documentation is available on docs.rs.

Contributors

Thanks to: * Thijs Cadier - thijsc

Alternatives