Reputation: 41
Can multiple producers share shame copy of conf? If you can not share same copy of conf, is it ok to share same dr_cb ?
Upvotes: 0
Views: 1487
Reputation: 3113
The C API (rd_kafka_new()
, rd_kafka_topic_new()
) will take ownership of the passed .._conf_t
object, so if you want to reuse it for another client or topic you will need to use the .._conf_dup()
function to make a copy first.
The C++ factory constructors copies the provided Conf
object automatically and does not take ownership of it.
You also mention multithreading: librdkafka is thread-safe and you can use the same producer or consumer client from multiple threads.
Upvotes: 1