2017-04-16 14:51:06 -07:00
2017-04-16 10:29:15 -07:00
2016-07-30 09:15:14 -07:00
2017-04-16 14:51:06 -07:00
2017-04-16 14:51:06 -07:00
2017-04-16 14:51:06 -07:00
2017-04-16 14:51:06 -07:00
2016-06-16 20:28:31 -07:00
2016-05-22 19:47:23 -07:00
2017-04-16 10:29:15 -07:00
2016-06-05 18:19:23 -07:00

cppkafka


High level C++ wrapper for rdkafka


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. cppkafka requires rdkakfa >= 0.9.1 in order to use it. Other wrapped functionalities are also provided, like fetching metadata, offsets, etc.

Note: cppkafka is under development so the API might change through time. Once there's an actual release, it should become more stable.

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>

using namespace std;
using namespace cppkafka;

int main() {
    // Create the config
    Configuration config = {
        { "metadata.broker.list", "127.0.0.1:9092" }
    };

    // Create the producer
    Producer producer(config);

    // Get the topic we'll write into
    Topic topic = producer.get_topic("my_topic");

    // Produce a message!
    string message = "hey there!";
    producer.produce(MessageBuilder(topic).partition(0).payload(message));
}

Compiling

In order to compile cppkafka you need:

  • rdkafka >= 0.9.1
  • CMake
  • A compiler with good C++11 support (e.g. gcc >= 4.8). 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

Documentation

You can generate the documentation by running make docs inside the build directory. This requires Doxygen to be installed. The documentation will be written in html format at <build-dir>/docs/html/.

Description
No description provided
Readme BSD-2-Clause 827 KiB
Languages
C++ 94.4%
CMake 3.8%
C 1.8%