summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.cpp
blob: d78a767102ecd1330eea142b588faff2acf2514d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <librdkafka/rdkafkacpp.h>


int main() {
  std::cout << "librdkafka++ " << RdKafka::version_str() << std::endl;

  RdKafka::Conf *conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);

  std::string features;

  if (conf->get("builtin.features", features) != RdKafka::Conf::CONF_OK) {
    std::cerr << "conf_get failed" << std::endl;
    return 1;
  }

  std::cout << "builtin.features " << features << std::endl;

  std::string errstr;
  RdKafka::Producer *producer = RdKafka::Producer::create(conf, errstr);
  if (!producer) {
    std::cerr << "Producer::create failed: " << errstr << std::endl;
    return 1;
  }

  delete conf;

  std::cout << "client name " << producer->name() << std::endl;


  delete producer;

  return 0;
}