I am trying to create transactional producer in c using librdkafka library.Below is the code how i created the transactional producer using librdkafka library
how i created:-
char *brokers = "localhost:9092"; // Kafka broker(s) address
char *topic = "mytopic"; // Kafka topic name
rd_kafka_t *rk; //producer handle
rd_kafka_conf_t *conf; //conf handle
char errstr[512];
conf = rd_kafka_conf_new();
if (rd_kafka_conf_set(conf, "bootstrap.servers", brokers, errstr, sizeof(errstr)) != RD_KAFKA_CONF_OK)
{
fprintf(stderr, "%% Configuration failed: %s\n", errstr);
return 1;
}
if (rd_kafka_conf_set(conf, "transactional.id", "100", errstr, sizeof(errstr)) != RD_KAFKA_CONF_OK)
{
fprintf(stderr, "%% Configuration failed for producer in bootstrapping: %s\n", errstr);
}
rk = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errstr, sizeof(errstr));
if (!rk)
{
fprintf(stderr, "%% Failed to create producer: %s\n", errstr);
return 1;
}
My Question :- Is there any way to reuse already created producer instance to send another transaction like 101..?