-2

I am very new to KAFKA broker and as per the requirement producer has to COMMIT messages.(Using librdkafka c/c++ libraries)

So, Firstly in my producer.c i used rd_kafka_commit (rk,NULL,0) but i got below error RD_KAFKA_RESP_ERR__UNKNOWN_GROUP = -179 (Unknown client group)

Now I am using this method rd_kafka_commit_transaction() in my producer.c but getting compilation error below.

undefined reference to `rd_kafka_init_transactions'

Please help me how to proceed further.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

If you want to use the transaction management of the Kafka Producer then you have to

  • first initiate a new transaction using the method rd_kafka_init_transactions()here on your producer

  • Then you have to call rd_kafka_begin_transaction() here.

  • After that produce a message

  • last step should be to commit the transaction using rd_kafka_commit_transaction().

I hope this helps!

Neenad
  • 861
  • 5
  • 19
  • Thanks for the reply. Apart from transactional API do we have any way to commit producer messages? – Nishtha Yadav Feb 22 '23 at 11:52
  • I am not sore what is your exact use case but the librdkafka docs explains everything well here https://github.com/confluentinc/librdkafka/blob/master/INTRODUCTION.md#producer-api – Neenad Feb 22 '23 at 12:28