diff --git a/CHANGELOG.md b/CHANGELOG.md index 662897ec..b4cd7b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.18.0 (Unreleased) - [Enhancement] Update `librdkafka` to `2.5.0` +- [Enhancement] Do not release GVL on `rd_kafka_name` (ferrous26) - [Patch] Patch cooperative-sticky assignments in librdkafka. - [Fix] Mitigate a case where FFI would not restart the background events callback dispatcher in forks - [Fix] Fix unused variable reference in producer (lucasmvnascimento) diff --git a/lib/rdkafka/bindings.rb b/lib/rdkafka/bindings.rb index e2692199..4a9e5269 100644 --- a/lib/rdkafka/bindings.rb +++ b/lib/rdkafka/bindings.rb @@ -2,6 +2,15 @@ module Rdkafka # @private + # + # @note + # There are two types of responses related to errors: + # - rd_kafka_error_t - a C object that we need to remap into an error or null when no error + # - rd_kafka_resp_err_t - response error code (numeric) that we can use directly + # + # It is critical to ensure, that we handle them correctly. The result type should be: + # - rd_kafka_error_t - :pointer + # - rd_kafka_resp_err_t - :int module Bindings extend FFI::Library @@ -38,7 +47,7 @@ class SizePtr < FFI::Struct # Metadata - attach_function :rd_kafka_name, [:pointer], :string, blocking: true + attach_function :rd_kafka_name, [:pointer], :string attach_function :rd_kafka_memberid, [:pointer], :string, blocking: true attach_function :rd_kafka_clusterid, [:pointer], :string, blocking: true attach_function :rd_kafka_metadata, [:pointer, :int, :pointer, :pointer, :int], :int, blocking: true @@ -84,7 +93,7 @@ class TopicPartitionList < FFI::Struct end attach_function :rd_kafka_topic_partition_list_new, [:int32], :pointer - attach_function :rd_kafka_topic_partition_list_add, [:pointer, :string, :int32], :void + attach_function :rd_kafka_topic_partition_list_add, [:pointer, :string, :int32], :pointer attach_function :rd_kafka_topic_partition_list_set_offset, [:pointer, :string, :int32, :int64], :void attach_function :rd_kafka_topic_partition_list_destroy, [:pointer], :void attach_function :rd_kafka_topic_partition_list_copy, [:pointer], :pointer @@ -140,6 +149,11 @@ class NativeErrorDesc < FFI::Struct attach_function :rd_kafka_err2name, [:int], :string attach_function :rd_kafka_err2str, [:int], :string + attach_function :rd_kafka_error_is_fatal, [:pointer], :int + attach_function :rd_kafka_error_is_retriable, [:pointer], :int + attach_function :rd_kafka_error_txn_requires_abort, [:pointer], :int + attach_function :rd_kafka_error_destroy, [:pointer], :void + attach_function :rd_kafka_error_code, [:pointer], :int attach_function :rd_kafka_get_err_descs, [:pointer, :pointer], :void # Configuration @@ -210,7 +224,7 @@ class NativeErrorDesc < FFI::Struct :void, [:pointer, :int, :string, :pointer] ) do |_client_prr, err_code, reason, _opaque| if Rdkafka::Config.error_callback - error = Rdkafka::RdkafkaError.new(err_code, broker_message: reason) + error = Rdkafka::RdkafkaError.build(err_code, broker_message: reason) error.set_backtrace(caller) Rdkafka::Config.error_callback.call(error) end @@ -347,6 +361,11 @@ class NativeErrorDesc < FFI::Struct attach_function :rd_kafka_purge, [:pointer, :int], :int, blocking: true callback :delivery_cb, [:pointer, :pointer, :pointer], :void attach_function :rd_kafka_conf_set_dr_msg_cb, [:pointer, :delivery_cb], :void + attach_function :rd_kafka_init_transactions, [:pointer, :int], :pointer, blocking: true + attach_function :rd_kafka_send_offsets_to_transaction, [:pointer, :pointer, :pointer, :int], :pointer, blocking: true + attach_function :rd_kafka_begin_transaction, [:pointer], :pointer, blocking: true + attach_function :rd_kafka_abort_transaction, [:pointer, :int], :pointer, blocking: true + attach_function :rd_kafka_commit_transaction, [:pointer, :int], :pointer, blocking: true # Partitioner PARTITIONERS = %w(random consistent consistent_random murmur2 murmur2_random fnv1a fnv1a_random).each_with_object({}) do |name, hsh|
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: