Skip to content
The Apache Kafka C/C++ library
C C++ Shell Python CMake Makefile Other
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Issue template update Dec 11, 2017
debian Generate static library that includes available static dependencies Mar 27, 2020
examples Fix missing txn abortable renaming Mar 16, 2020
mklove configure: OpenSSL URLs changed, and propagate http error code when c… Apr 1, 2020
packaging nuget: Fix format string error Mar 31, 2020
src-cpp Bump version define to v1.4.0 final Mar 31, 2020
src Seed the PRNG by default, allow application to override with enable.r… Apr 3, 2020
tests Fix two test memory leaks Mar 31, 2020
win32 Generate static library that includes available static dependencies Mar 27, 2020
.appveyor.yml appveyor: cd .. after tests to unbreak nuget packaging Feb 11, 2020
.dir-locals.el Update emacs dir-locals: fix compile command, add 8 ws indent. Aug 16, 2019
.doozer.json CI: Run local tests in quick mode too Feb 5, 2020
.gdbmacros Added gdbmacro for msg queues Nov 21, 2018
.gitignore Fix run-test.sh Feb 5, 2020
.travis.yml travis: Disable homebrew auto update on old xcode image to avoid time… Mar 27, 2020
CMakeLists.txt Set thread names on macOS Aug 14, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Oct 18, 2017
CONFIGURATION.md Seed the PRNG by default, allow application to override with enable.r… Apr 3, 2020
CONTRIBUTING.md Improve test build and run instructions Sep 26, 2019
Doxyfile Add consumer group state diagram to manual Feb 5, 2020
INTRODUCTION.md Feature updates to README and manual Apr 3, 2020
LICENSE Install LICENSE file (and restore LICENSE install in rpm spec) Mar 31, 2020
LICENSE.crc32c Import of crc32c from http://stackoverflow.com/a/17646775/1821055 May 31, 2017
LICENSE.fnv1a partitioner: Add FNV-1a partitioner (#2724) Mar 11, 2020
LICENSE.hdrhistogram Ported Coda Hale's Golang HdrHistogram to C May 31, 2018
LICENSE.lz4 Generate static library that includes available static dependencies Mar 27, 2020
LICENSE.murmur2 Refactor murmur2 code and add more unit tests (unaligned access) Jan 3, 2018
LICENSE.pycrc Extracted rdkafka from librd to its own library. Sep 19, 2012
LICENSE.queue Native Win32 (VS) support (take one) Mar 24, 2015
LICENSE.regexp regexp import from ccxvii/minilibs sha 875c33568b5a4aa4fb3dd0c52ea98f… Sep 28, 2016
LICENSE.snappy snappy-c upstream update: Clean import of andikleen/snappy-c@8015f2d Nov 5, 2015
LICENSE.tinycthread clean tinycthread import tinycthread.c at ce82058b05180ce, tinycthrea… Mar 23, 2015
LICENSE.wingetopt clean wingetopt import of wingetopt.c and wingetopt.h at version 281d… Mar 23, 2015
LICENSES.txt Install LICENSE file (and restore LICENSE install in rpm spec) Mar 31, 2020
Makefile Install LICENSE file (and restore LICENSE install in rpm spec) Mar 31, 2020
README.md Feature updates to README and manual Apr 3, 2020
README.win32 Update README.win32 May 21, 2019
STATISTICS.md Correct statistics names in docs Mar 10, 2020
configure mklove: fix ./configure --reconfigure Nov 24, 2016
configure.self Added --disable-syslog and build static osx libs on older OSX 10.12 t… Mar 27, 2020
dev-conf.sh dev-conf.sh: fix default flags passed to ./configure Feb 5, 2020
lds-gen.py lds-gen: ignore function references (#2696) Feb 5, 2020
mainpage.doxy Fix doxygen documentation Mar 14, 2019

README.md

librdkafka - the Apache Kafka C/C++ client library

Copyright (c) 2012-2020, Magnus Edenhill.

https://github.com/edenhill/librdkafka

librdkafka is a C library implementation of the Apache Kafka protocol, providing Producer, Consumer and Admin clients. It was designed with message delivery reliability and high performance in mind, current figures exceed 1 million msgs/second for the producer and 3 million msgs/second for the consumer.

librdkafka is licensed under the 2-clause BSD license.

Features

  • Full Exactly-Once-Semantics (EOS) support
  • High-level producer, including Idempotent and Transactional producers
  • High-level balanced KafkaConsumer (requires broker >= 0.9)
  • Simple (legacy) consumer
  • Admin client
  • Compression: snappy, gzip, lz4, zstd
  • SSL support
  • SASL (GSSAPI/Kerberos/SSPI, PLAIN, SCRAM, OAUTHBEARER) support
  • Full list of supported KIPs
  • Broker version support: >=0.8 (see Broker version compatibility)
  • Guaranteed API stability for C & C++ APIs (ABI safety guaranteed for C)
  • Statistics metrics
  • Debian package: librdkafka1 and librdkafka-dev in Debian and Ubuntu
  • RPM package: librdkafka and librdkafka-devel
  • Gentoo package: dev-libs/librdkafka
  • Portable: runs on Linux, OSX, Win32, Solaris, FreeBSD, AIX, ...

Documentation

NOTE: The master branch is actively developed, use latest release for production use.

Installation

Installing prebuilt packages

On Mac OSX, install librdkafka with homebrew:

$ brew install librdkafka

On Debian and Ubuntu, install librdkafka from the Confluent APT repositories, see instructions here and then install librdkafka:

$ apt install librdkafka-dev

On RedHat, CentOS, Fedora, install librdkafka from the Confluent YUM repositories, instructions here and then install librdkafka:

$ yum install librdkafka-devel

On Windows, reference librdkafka.redist NuGet package in your Visual Studio project.

For other platforms, follow the source building instructions below.

Installing librdkafka using vcpkg

You can download and install librdkafka using the vcpkg dependency manager:

# Install vcpkg if not already installed
$ git clone https://github.com/Microsoft/vcpkg.git
$ cd vcpkg
$ ./bootstrap-vcpkg.sh
$ ./vcpkg integrate install

# Install librdkafka
$ vcpkg install librdkafka

The librdkafka paackage in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Build from source

Requirements

The GNU toolchain
GNU make
pthreads
zlib-dev (optional, for gzip compression support)
libssl-dev (optional, for SSL and SASL SCRAM support)
libsasl2-dev (optional, for SASL GSSAPI support)
libzstd-dev (optional, for ZStd compression support)

NOTE: Static linking of ZStd (requires zstd >= 1.2.1) in the producer enables encoding the original size in the compression frame header, which will speed up the consumer. Use STATIC_LIB_libzstd=/path/to/libzstd.a ./configure --enable-static to enable static ZStd linking. MacOSX example: STATIC_LIB_libzstd=$(brew ls -v zstd | grep libzstd.a$) ./configure --enable-static

Building

  ./configure
  # Or, to automatically install dependencies using the system's package manager:
  # ./configure --install-deps
  # Or, build dependencies from source:
  # ./configure --install-deps --source-deps-only

  make
  sudo make install

NOTE: See README.win32 for instructions how to build on Windows with Microsoft Visual Studio.

NOTE: See CMake instructions for experimental CMake build (unsupported).

Usage in code

  1. Refer to the examples directory for code using:
  • Producers: basic producers, idempotent producers
  • Consumers: basic consumers, reading batches of messages
  • Performance tester
  1. Refer to the examples GitHub repo for code connecting to a cloud streaming data service based on Apache Kafka

  2. Link your program with -lrdkafka (C) or -lrdkafka++ (C++).

Commercial support

Commercial support is available from Confluent Inc

Community support

Only the last official release is supported for community members.

File bug reports, feature requests and questions using GitHub Issues

Questions and discussions are also welcome on the Confluent Community slack #clients channel, or irc.freenode.org #apache-kafka channel.

Language bindings

Users of librdkafka

You can’t perform that action at this time.