Note that the return type of the passed function is int:
If the application wishes to hold on to the json pointer and free it at a later time it must return 1 from the stats_cb. If the application returns 0 from the stats_cb then librdkafka will immediately free the json pointer.
According to the rdkafka doc, the
rd_kafka_conf_set_stats_cb
is defined as follows:Note that the return type of the passed function is
int
:Source: https://docs.confluent.io/3.3.1/clients/librdkafka/rdkafka_8h.html#a597d00432e3ca22174d18e7e348fb766
In hw-kafka-client, the FFI definition is as follows:
I believe instead it should be:
And I think we want to always return zero, as the callback copies the json into a new bytestring.
I have no idea what the implications of this bug are, maybe it is not a problem in practice, maybe it is...
I will make a PR next week or so.