It would be good to have instance name (rd_kafka_name) in the error for debug purposes. Now we get an error message but there is no way to tie it back to particular native kafka instance. A change that would include the rd_kafka_name in the error would fix that.
basically something like this:
mod.attach_function :rd_kafka_name, [:pointer], :string
FFI::Function.new(
:void, [:pointer, :int, :string, :pointer]
) do |client_prr, err_code, reason, _opaque|
if ::Rdkafka::Config.error_callback
name = rd_kafka_name client_prr
error = ::Rdkafka::RdkafkaError.new(name, err_code, broker_message: reason)
::Rdkafka::Config.error_callback.call(error)
# or alternatively if not in error, we could pass it alongside but this would change the API, so not that nice
::Rdkafka::Config.error_callback.call(name, error)
end
end
(I am willing to implement it)
It would be good to have instance name (rd_kafka_name) in the error for debug purposes. Now we get an error message but there is no way to tie it back to particular native kafka instance. A change that would include the
rd_kafka_name
in the error would fix that.basically something like this:
If :+1: then I can quickly add it.