You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Go to file
Magnus Edenhill bb9dbd3c24
Removed compression field to be 0.6 protocol compatible
10 years ago
examples Added examples/rdkafka_performance performance testing tool. 11 years ago
.dir-locals.el Extracted rdkafka from librd to its own library. 11 years ago
.gitignore Extracted rdkafka from librd to its own library. 11 years ago
LICENSE Extracted rdkafka from librd to its own library. 11 years ago
LICENSE.pycrc Extracted rdkafka from librd to its own library. 11 years ago
Makefile Extracted rdkafka from librd to its own library. 11 years ago
README.md Added Coderwall endorse button 11 years ago
rd.c Extracted rdkafka from librd to its own library. 11 years ago
rd.h Extracted rdkafka from librd to its own library. 11 years ago
rdaddr.c Extracted rdkafka from librd to its own library. 11 years ago
rdaddr.h Extracted rdkafka from librd to its own library. 11 years ago
rdcrc32.c Extracted rdkafka from librd to its own library. 11 years ago
rdcrc32.h Extracted rdkafka from librd to its own library. 11 years ago
rdfile.c Extracted rdkafka from librd to its own library. 11 years ago
rdfile.h Extracted rdkafka from librd to its own library. 11 years ago
rdgz.c Extracted rdkafka from librd to its own library. 11 years ago
rdgz.h Extracted rdkafka from librd to its own library. 11 years ago
rdkafka.c Removed compression field to be 0.6 protocol compatible 10 years ago
rdkafka.h Removed compression field to be 0.6 protocol compatible 10 years ago
rdrand.c Extracted rdkafka from librd to its own library. 11 years ago
rdrand.h Extracted rdkafka from librd to its own library. 11 years ago
rdtime.h Extracted rdkafka from librd to its own library. 11 years ago
rdtypes.h Extracted rdkafka from librd to its own library. 11 years ago

README.md

librdkafka - Apache Kafka C client library

Copyright (c) 2012, Magnus Edenhill, et.al.

https://github.com/edenhill/librdkafka

endorse

librdkafka is a C implementation of the Apache Kafka protocol, containing both Producer and Consumer support. It currently supports Apache Kafka version 0.7.* (and possibly earlier).

ZooKeeper integration is planned but currently not available.

librdkafka is licensed under the 2-clause BSD license.

Usage

Requirements

The GNU toolchain
pthreads
zlib

Instructions

Building

  make all
  make install
  # or to install in another location than /usr/local:
  PREFIX=/my/prefix make install

Usage in code

See examples/rdkafka_example.c for full examples of both producer and consumer sides.

  #include <librdkafka/rdkafka.h>

  ..

  rd_kafka_t *rk;

  rk = rd_kafka_new_consumer(broker, topic, partition, 0, &conf)

  while (run) {      
      rko = rd_kafka_consume(rk, RD_POLL_INFINITE);
      if (rko->rko_err)
        ..errhandling..
      else if (rko->rko_len)
        handle_message(rko->rko_payload, rko->rko_len);
  }

  rd_kafka_destroy(rk);

Link your program with -lrdkafka -lz -lpthread -lrt.

Documentation

The API is documented in rdkafka.h

Examples

See the examples/sub-directory.