rdkafka provides Ruby bindings to librdkafka, a high-performance C library for Apache Kafka clients. The gem offers both producer and consumer interfaces for working with Kafka message streams, handling the complexity of Kafka protocol operations, connection management, and message delivery guarantees. It brings librdkafka's production-grade reliability and performance characteristics to Ruby applications.
The library supports Kafka's key features including partitioning, consumer groups, offset management, and exactly-once semantics. It provides asynchronous message production with delivery callbacks, configurable acknowledgment modes, and automatic retry logic. For consumers, rdkafka handles partition assignment, rebalancing, and offset commits with options for both manual and automatic control. The gem includes comprehensive configuration options for tuning performance, reliability, and resource usage, exposing librdkafka's extensive parameter set through Ruby-friendly interfaces.
rdkafka is essential for Ruby applications integrating with Kafka-based data pipelines, event streaming platforms, and message-driven architectures. It's used in microservices for asynchronous communication, in data processing systems for consuming and producing Kafka streams, and in event sourcing architectures. The gem's librdkafka foundation provides production-ready reliability and performance, making it suitable for high-throughput scenarios where message delivery guarantees and low latency matter.
gem install rdkafka Run this gem instantly in your browser without any installation:
Open in RunRuby.dev →All 73 versions available for installation