8

I have been searching for C++ kafka consumer. I came across following which are for C++ kafka but there is no consumer.

https://github.com/adobe-research/libkafka (Only sample producer)

https://github.com/edenhill/librdkafka/tree/master/src-cpp

Does anyone have C++ kafka consumer based on the above work or any new way for C++ kafka consumer

user3619015
  • 176
  • 1
  • 1
  • 9

3 Answers3

11

librdkafka's examples/ directory contains a C++ consumer (and producer):

High-level balanced KafkaConsumer: https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_complex_consumer_example.cpp

Low-level legacy Consumer: https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.cpp#L395

Contango
  • 76,540
  • 58
  • 260
  • 305
Edenhill
  • 2,897
  • 22
  • 35
9

As a follow up on Edenhill's answer, you can try cppkafka, a high level C++11 wrapper for librdkafka. There's some examples in there for you to look at.

mfontanini
  • 21,410
  • 4
  • 65
  • 73
  • librdkafka for c++ programmers is hard to learn, e.g. do not know how to config topic name in example cpp file. Thanks for your help. – Dean Chen Jul 21 '18 at 12:40
2

If you want to use modern cpp, you can use this wrapper around librdkafka modern-cpp-kafka

MOHRE
  • 1,096
  • 4
  • 15
  • 28