0

I am trying to consume kafka msg using c++. I have installed librdkafka and trying the example https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.cpp

Now my concern is how to pass username, password and truststore to kafka consumer?

OneCricketeer
  • 126,858
  • 14
  • 92
  • 185
  • Have you looked at the main Readme for the available properties around ssl or sasl configs? Truststore is only in Java. You need to convert to a certificate – OneCricketeer Feb 13 '20 at 13:33

1 Answers1

1

Depending on which authentication mechanism that the broker is configured with you will need to configure the client with the following configuration properties:

  • security.protocol=SASL_PLAINTEXT or SASL_SSL, depending on if SSL is used.
  • sasl.mechanism=PLAIN or any of the other mechanisms, see CONFIGURATION.md
  • sasl.username=... and sasl.password=.. for PLAIN and SCRAM-.. mechanisms.
  • sasl.kerberos.service.name=.. for GSSAPI/Kerberos.

See CONFIGURATION.md for all available configuration properties, SASL mechanisms, etc.

Edenhill
  • 2,298
  • 17
  • 30
  • Hi Edenhill, Thanks for the response. I am trying to understand your example provided at https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_complex_consumer_example.cpp I can see brokers, groupid values taken as cmd arguments. I am bit confused, how to pass configuration.properties. to This C++ program. Do the temporary configuration object automatically picks up the properties? – Sarada Chelluboyena Feb 14 '20 at 03:44
  • `conf->set("security.protocol", "SASL_PLAINTEXT", errstr);` – Edenhill Feb 14 '20 at 07:35