2016-06-16 07:46:55 -07:00
2016-06-14 19:03:20 -07:00
2016-06-16 07:46:55 -07:00
2016-06-16 07:46:55 -07:00
2016-06-16 07:46:55 -07:00
2016-06-12 17:49:11 -07:00
2016-05-22 19:47:23 -07:00
2016-06-14 21:03:07 -07:00
2016-06-05 18:19:23 -07:00
2016-06-14 20:52:27 -07:00

cppkafka


High level C++ wrapper for rdkafka

Still in development!


Features

  • cppkafka is a high level C++ wrapper for rdkafka, aiming at allowing to use rdkafka in a simple, less error prone way.

  • cppkafka provides an API to produce messages as well as consuming messages but the latter is only supported via the high level consumer API (introduced on kafka 0.9). Therefore, you need rdkakfa >= 0.9 in order to use it. Other wrapped functionalities are also provided, like fetching metadata, offsets, etc.

  • cppkafka adds smooth zookeeper support: you only need to add a "zookeeper" attribute to your configuration object and your producer/consumer will automatically load the initial broker list from it while also listening for broker list updates.

It's simple!

cppkafka's API is simple. For example, this code creates a producer writes a message into some partition:

#include <cppkafka/producer.h>
#include <string>
using namespace cppkafka;
using namespace std;
int main() {
    // Create the config
    Configuration config;
    config.set("zookeeper", "127.0.0.1:2181");
    // Create the producer
    Producer producer(config);
    // Get the topic we'll write into
    Topic topic = producer.get_topic("my_topic");
    string message = "hey there!";
    // Produce a message!
    producer.produce(topic, 0 /*partition*/, message);
}

Compiling

In order to compile cppkafka you need:

  • rdkafka >= 0.9
  • Optionally libzookeeper. This is used by default, but you can disable it invoking cmake using the -DENABLE_ZOOKEEPER=0 argument.
  • A compiler with good C++11 support. This was tested successfully on g++ 4.8.3.
  • The boost library. cppkafka only requires boost.optional, which is a header only library, so this doesn't add any additional runtime dependencies.

Now, in order to build, just run:

mkdir build
cd build
cmake ..
make

Using

If you want to use cppkafka, you'll need to link your application with:

  • cppkafka
  • rdkafka
  • zookeeper if you enabled it during build time (it's on by default).
Description
No description provided
Readme BSD-2-Clause 827 KiB
Languages
C++ 94.4%
CMake 3.8%
C 1.8%