rdkafka 0.28.0-x86_64-linux-gnu → 0.29.0-x86_64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/README.md +1 -0
- data/docker-compose-ssl.yml +1 -1
- data/docker-compose.yml +1 -1
- data/ext/librdkafka.so +0 -0
- data/lib/rdkafka/abstract_handle.rb +31 -2
- data/lib/rdkafka/admin/config_binding_result.rb +2 -2
- data/lib/rdkafka/admin/create_acl_handle.rb +6 -5
- data/lib/rdkafka/admin/create_partitions_handle.rb +4 -6
- data/lib/rdkafka/admin/create_topic_handle.rb +4 -6
- data/lib/rdkafka/admin/delete_acl_handle.rb +5 -7
- data/lib/rdkafka/admin/delete_groups_handle.rb +4 -6
- data/lib/rdkafka/admin/delete_topic_handle.rb +4 -6
- data/lib/rdkafka/admin/describe_acl_handle.rb +5 -7
- data/lib/rdkafka/admin/describe_configs_handle.rb +4 -10
- data/lib/rdkafka/admin/describe_configs_report.rb +1 -5
- data/lib/rdkafka/admin/incremental_alter_configs_handle.rb +4 -10
- data/lib/rdkafka/admin/incremental_alter_configs_report.rb +1 -5
- data/lib/rdkafka/admin/list_offsets_handle.rb +5 -10
- data/lib/rdkafka/admin.rb +75 -43
- data/lib/rdkafka/bindings.rb +9 -4
- data/lib/rdkafka/callbacks/base_handler.rb +62 -0
- data/lib/rdkafka/callbacks/create_acl_handler.rb +37 -0
- data/lib/rdkafka/callbacks/create_partitions_handler.rb +37 -0
- data/lib/rdkafka/callbacks/create_topic_handler.rb +37 -0
- data/lib/rdkafka/callbacks/delete_acl_handler.rb +42 -0
- data/lib/rdkafka/callbacks/delete_groups_handler.rb +37 -0
- data/lib/rdkafka/callbacks/delete_topic_handler.rb +37 -0
- data/lib/rdkafka/callbacks/describe_acl_handler.rb +35 -0
- data/lib/rdkafka/callbacks/describe_configs_handler.rb +42 -0
- data/lib/rdkafka/callbacks/incremental_alter_configs_handler.rb +42 -0
- data/lib/rdkafka/callbacks/list_offsets_handler.rb +42 -0
- data/lib/rdkafka/callbacks.rb +50 -244
- data/lib/rdkafka/config.rb +45 -33
- data/lib/rdkafka/consumer/headers.rb +19 -5
- data/lib/rdkafka/consumer/partition.rb +8 -1
- data/lib/rdkafka/consumer/topic_partition_list.rb +44 -22
- data/lib/rdkafka/consumer.rb +111 -21
- data/lib/rdkafka/defaults.rb +19 -0
- data/lib/rdkafka/helpers/metadata.rb +29 -0
- data/lib/rdkafka/metadata.rb +86 -19
- data/lib/rdkafka/native_kafka.rb +2 -4
- data/lib/rdkafka/producer/delivery_handle.rb +3 -3
- data/lib/rdkafka/producer/partitions_count_cache.rb +24 -38
- data/lib/rdkafka/producer.rb +56 -44
- data/lib/rdkafka/version.rb +3 -3
- data/lib/rdkafka.rb +12 -0
- data/package-lock.json +3 -3
- data/rdkafka.gemspec +1 -0
- metadata +13 -4
- data/Gemfile +0 -13
- data/Gemfile.lint +0 -14
- data/Gemfile.lint.lock +0 -123
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bcf117ef111167dd38956af04a4c94e3f44046a309b031c4a71899664f479d90
|
|
4
|
+
data.tar.gz: 4e6da6163473852ba2874e92453491b83006d04c43be5d6dff0cb263f890c56b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c51b226cfb5d3d6aaf1e9b6144205112a5b8262a89d0af0ba5d1e537b7f77e5cf4b1e116b58cb69de9191c45f65d0435fa58af56dba8c8f54fdc868dfc9aa470
|
|
7
|
+
data.tar.gz: b307956eade4134429ad32acd2a501ad092b248eef269e02fdc58dc4b755fa06ea7535c8439eb5c46b7e4f707c37c5fb7347091746afe69d2b8f2ea63eac9e15
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Rdkafka Changelog
|
|
2
2
|
|
|
3
|
+
## 0.29.0 (2026-07-10)
|
|
4
|
+
- [Enhancement] Bump librdkafka to `2.14.2`
|
|
5
|
+
- [Enhancement] Add `Consumer#metadata` and `Producer#metadata`, mirroring `Admin#metadata`, so cluster/topic metadata can be fetched from an existing consumer or producer handle without opening a dedicated admin connection.
|
|
6
|
+
- [Enhancement] Support offset-commit metadata: `Consumer#store_offset(message, metadata)` stores an optional metadata string alongside the offset, `Consumer::Partition#metadata` exposes it, and `TopicPartitionList` marshals it to and from the native list (read back via `Consumer#committed`).
|
|
7
|
+
- [Fix] Cache the partition count for a missing topic. `Producer#partition_count` rescued `unknown_topic_or_part` outside the cache block, so nothing was cached and every `produce(partition_key:)` to a missing topic re-ran a blocking metadata query. The rescue now runs inside the cache block so `RD_KAFKA_PARTITION_UA` is cached like any other count; other errors are still re-raised.
|
|
8
|
+
- [Fix] Let `PartitionsCountCache` adopt a lower partition count once the cached entry has expired. The cache prioritizes higher counts (partition counts only grow during normal operation), but it did so unconditionally: after the TTL expired it fetched the true lower count, discarded it, and re-armed the TTL on the stale higher count - permanently. A topic recreated with fewer partitions then made `produce` (with a partition key) fail with `unknown_partition` for the dropped partitions until process restart. A lower value is now adopted on the first refresh after expiry, while still being ignored within the TTL window so a transient or racy lower read cannot clobber a correct higher count.
|
|
9
|
+
- [Fix] Surface per-message build errors inline in `Consumer#poll_batch`/`#poll_batch_nb` instead of discarding the batch. A message that failed to build (e.g. a header read error) raised out of the loop, losing the already-built messages - whose offsets may have been auto-stored - while error-flagged messages were already returned inline. Build failures are now returned as inline `RdkafkaError` entries alongside the successfully built messages.
|
|
10
|
+
- [Fix] Bound the `Metadata` retry loop by a wall-clock budget (`Defaults::METADATA_RETRY_BUDGET_MS`, 5s) with a minimum-attempts floor (`Defaults::METADATA_MIN_ATTEMPTS`, 3), cap the exponential backoff at `Defaults::METADATA_RETRY_BACKOFF_MAX_MS` (1s), and stop overwriting the request timeout with the backoff value. Each retry used to shrink the first retries' request timeout below the configured value (near-guaranteeing another timeout) and inflate later ones to ~100s, with cumulative sleeps alone reaching ~204s - a synchronous metadata fetch could block the caller for minutes.
|
|
11
|
+
- [Fix] Synchronize `AbstractHandle::REGISTRY` mutations. The handle registry is a plain Hash mutated from producing/consuming threads and the background polling thread (which removes handles from FFI callbacks). That is effectively safe on MRI under the GVL but not on JRuby, where a lost write could leave a handle unregistered (never unlocked, so `wait` times out for a delivered message) or never removed (permanent leak). `register`/`remove` now guard the Hash with a mutex.
|
|
12
|
+
- [Fix] Fix the NULL background-queue cleanup branches in `Admin#delete_group`, `Admin#delete_acl` and `Admin#describe_acl`, which referenced undefined local variables. When `rd_kafka_queue_get_background` returned NULL, those branches raised a `NameError` instead of the intended `ConfigError` and leaked the already-allocated native request object, and `delete_group` additionally called the wrong destructor. They now destroy the correct object and raise `ConfigError`.
|
|
13
|
+
- [Fix] Actually populate `ConfigBindingResult#synonyms`. The synonym loop built the synonym binding objects and discarded them, so `#synonyms` was always an empty array; they are now appended.
|
|
14
|
+
- [Fix] Stop leaking the native `rd_kafka_topic_conf_t` in `Producer#set_topic_config` when a per-topic config value is rejected. The conf is built with `rd_kafka_topic_conf_new` and only handed to `rd_kafka_topic_new` afterwards; if `rd_kafka_topic_conf_set` returned a non-`:config_ok` result the method raised before `rd_kafka_topic_new` was ever called, so librdkafka never took ownership of the conf and it leaked. The conf is now destroyed before raising.
|
|
15
|
+
- [Fix] Add the missing `closed_consumer_check` to `Consumer#position`, the only public consumer method without one; calling it on a closed consumer now raises a consistent `ClosedConsumerError` instead of failing deeper in the call.
|
|
16
|
+
- [Fix] Guard the OAuthBearer token refresh callback against a NULL client pointer before calling `rd_kafka_name` on it.
|
|
17
|
+
- [Fix] Make the `Consumer` GC finalizer close the consumer and destroy its consumer queue, not just the native client. The finalizer used the generic `NativeKafka` one, which went straight to `rd_kafka_destroy` and skipped `rd_kafka_consumer_close` and `rd_kafka_queue_destroy`. A consumer that used `poll_batch` (which takes a consumer-queue reference) and was then garbage-collected without an explicit `close` left that reference dangling, which could make `rd_kafka_destroy` block inside the finalizer (process hang at GC/shutdown) or leak the handle. The consumer now installs its own finalizer that mirrors `#close` (the queue pointer is shared with the finalizer via a holder so it never captures the consumer and prevents collection).
|
|
18
|
+
- [Fix] Free the librdkafka-allocated string in `Consumer#cluster_id` and `Consumer#member_id` (previously copied via a `:string` binding but never freed) and fix the `rd_kafka_clusterid` arity to pass `timeout_ms`. `Consumer#cluster_id` now accepts a `timeout_ms` (default `Defaults::CONSUMER_CLUSTER_ID_TIMEOUT_MS`).
|
|
19
|
+
- [Fix] Attach `rd_kafka_query_watermark_offsets` with `blocking: true` so it releases the GVL during its broker round-trip. It was the only synchronous network call bound without the flag, so `Consumer#query_watermark_offsets` (and `Consumer#lag`, which calls it once per partition) froze every other Ruby thread in the process - including producer polling threads - for up to `timeout_ms`. Matches the neighboring `rd_kafka_offsets_for_times` binding.
|
|
20
|
+
- [Fix] Stop leaking the native `rd_kafka_conf_t` when client creation fails. `native_config` raised `ConfigError` mid-build (e.g. on an invalid option) without destroying the conf, and `native_kafka` raised `ClientCreationError` on a null `rd_kafka_new` without destroying it either. Both paths now call `rd_kafka_conf_destroy` before re-raising (librdkafka keeps app ownership of the conf on `rd_kafka_new` failure, so this is safe). Multi-KB leak per failed creation, relevant for supervisors retrying client creation on transient SASL/SSL misconfig.
|
|
21
|
+
- [Fix] Stop `Metadata` from leaking the native metadata struct (and a topic reference) on every retried fetch. `retry` restarts the `begin` block without running its `ensure`, so each retried attempt reassigned the pointers and only the last attempt's `rd_kafka_metadata` struct was ever destroyed; up to `METADATA_MAX_RETRIES` whole-cluster structs leaked per call (the `leader_not_available` case is routine during topic creation/leader election). Each attempt now frees its own native resources, and a failed fetch that never allocated a struct no longer calls `rd_kafka_metadata_destroy` on a NULL pointer.
|
|
22
|
+
- [Fix] Stop `Producer#produce` from orphaning the delivery handle in the process-global registry when it fails after registering it. The handle was only removed on a non-zero `rd_kafka_producev` return, so any exception between registration and that check (a concurrent `close` making `with_inner` raise `ClosedInnerError`, or a header value whose `#to_s` raises) leaked the handle forever - it survives producer close and accumulates in apps that recreate/close producers. `produce` now removes the handle on any such failure before re-raising.
|
|
23
|
+
- [Fix] Guard the message delivery callback so a raising user `delivery_callback` can no longer skip the handle unlock or crash the producer. `DeliveryCallback` invoked the user callback and only then unlocked the handle, with no rescue; if the callback raised, the handle stayed pending (so `wait` blocked until its timeout and raised `WaitTimeoutError` for a message that was actually delivered) and the exception unwound out of the FFI callback on librdkafka's polling thread (`abort_on_exception = true`), taking down the whole process. The user callback is now wrapped so exceptions are logged and swallowed (matching the rebalance callback) and the handle is always unlocked in an `ensure`.
|
|
24
|
+
- [Fix] Stop admin operations (`describe_configs`, `incremental_alter_configs`, `list_offsets`) from leaking native resources when their arguments are rejected. Each parsed user input (`.fetch`/offset validation) only after allocating the background queue, `AdminOptions`, the registered handle and per-resource native objects, so a `KeyError`/`ArgumentError` leaked all of them. Input is now fully parsed and validated before any native allocation.
|
|
25
|
+
- [Fix] Destroy the native topic-partition list in `TopicPartitionList#to_native_tpl` when population fails partway (e.g. an invalid partition). The caller-owned list was leaked on any exception mid-build; it is now destroyed before the error propagates.
|
|
26
|
+
- [Fix] Raise instead of silently dropping a rejected `incremental_alter_configs` entry. `rd_kafka_ConfigResource_add_incremental_config` returns an `rd_kafka_error_t` for an invalid op_type, an empty/nil name, or a nil value on a non-delete op; the result was ignored, so the entry was dropped, the alter request still reported success, and the error object leaked. The error is now surfaced as an `RdkafkaError` (raised before the request is sent) and the native error object is freed.
|
|
27
|
+
- [Fix] Allocate the admin result-count out-parameter as `:size_t` instead of `:int32`. Every librdkafka `rd_kafka_*_result_*(result, size_t *cntp)` accessor writes a full native `size_t` (8 bytes on 64-bit), but the count pointer was a 4-byte `FFI::MemoryPointer.new(:int32)` across the create/delete topic, create partitions, create/delete ACL, describe/incremental-alter configs and config-synonyms paths - a 4-byte heap overflow on every admin result parse (benign on little-endian, where the low word still reads the correct count, but undefined behavior). Now uses `:size_t`.
|
|
28
|
+
- [Fix] Stabilize the flaky `Consumer#lag` "calculates the consumer lag" spec on overloaded CI (e.g. macOS). The manual `consumer.commit` could raise `no_offset` when the default 5s background auto-commit had already committed the stored offsets, or when the auto offset store had not yet caught up with `poll`. The spec now raises `auto.commit.interval.ms` to 60s (matching the existing `#seek`/pause specs) and lets the offset store settle before committing.
|
|
29
|
+
- [Enhancement] Expose `replicas` and `isrs` (in-sync replica broker ids) on each partition in topic metadata (`Metadata#topics` partition hashes). The base struct `#to_h` skips FFI pointer members, so these two arrays were dropped entirely and the partition replica assignment was unavailable to callers (e.g. for planning replication-factor changes). `PartitionMetadata#to_h` now dereferences both pointers into arrays of broker ids.
|
|
30
|
+
- [Fix] Resolve admin operation handles from the event error when an admin operation fails at the operation level (e.g. brokers unreachable, or the client closed with the request in flight). librdkafka delivers such failures as a result event with the error set and an empty results array, but the create topic, delete topic, create partitions, delete groups, create ACL and delete ACL handlers indexed `results[0]` unconditionally. That raised inside the background event callback, so the handle was never unlocked and `wait` blocked until its own timeout and raised `WaitTimeoutError`, discarding the real error. These handlers now check the event error first and resolve the handle with the actual error code (the describe configs, incremental alter configs, describe ACL and list offsets handlers already did).
|
|
31
|
+
- [Enhancement] Extract the admin background-event result handlers into one class per operation under `lib/rdkafka/callbacks/` (`CreateTopicHandler`, `DescribeConfigsHandler`, etc., all subclasses of `Callbacks::BaseHandler`). `Callbacks::BackgroundEventCallback` is now a thin dispatcher that maps the event type to its handler and destroys the event. Purely internal reorganization (`Rdkafka::Callbacks` is private) with no behavior or API change.
|
|
32
|
+
- [Fix] Destroy admin API background events after processing. librdkafka requires the application to destroy each background event, but `rd_kafka_event_destroy` was never called (nor even bound), so every admin operation leaked its entire result event with all result arrays and strings. Reports are now built inside the callback (copying event-owned memory into Ruby objects) before the event is destroyed, and `DescribeConfigsReport`/`IncrementalAlterConfigsReport` no longer destroy the event-owned ConfigResource array, which also fixes a double free on repeated `wait` calls on the same handle. As part of this, the internal FFI struct fields on admin operation handles (e.g. `handle[:error_string]`, `handle[:result_name]`, `handle[:config_entries]`, `handle[:response_string]`, `handle[:matching_acls]`) were removed; they were never part of the public API (use `handle.wait` and the returned report objects, whose interfaces are unchanged).
|
|
33
|
+
- [Enhancement] Reuse per-thread scratch pointers in `Consumer::Headers.from_native` instead of allocating them for every consumed message. Previously each message paid one native pointer allocation just to check for headers and three more when headers were present; now the scratch pointers are allocated once per thread/fiber and reused, removing all per-message native scratch allocations from the consumer hot path.
|
|
34
|
+
- [Enhancement] Remove the unused `DeliveryHandle` `:topic_name` struct field and the per-message allocation that populated it. The delivery callback copied the topic name into a native `FFI::MemoryPointer` on every delivered message, retained for the lifetime of the handle, yet nothing ever read it: the topic is already available via `DeliveryHandle#topic` (a Ruby attribute set during `produce`) and `DeliveryReport#topic_name`, both of which work exactly as before.
|
|
35
|
+
|
|
3
36
|
## 0.28.0 (2026-06-03)
|
|
4
37
|
- [Enhancement] Bump librdkafka to `2.14.1`
|
|
5
38
|
- [Enhancement] Replace version-gated `Warning[:performance]` with dynamic `Warning.categories` opt-in in spec helper so new Ruby warning categories are automatically enabled without manual updates.
|
data/README.md
CHANGED
|
@@ -163,6 +163,7 @@ bundle exec rake produce_messages
|
|
|
163
163
|
|
|
164
164
|
| rdkafka-ruby | librdkafka | patches |
|
|
165
165
|
|-|-|-|
|
|
166
|
+
| 0.29.x (2026-07-10) | 2.14.2 (2026-06-03) | yes |
|
|
166
167
|
| 0.28.x (2026-06-03) | 2.14.1 (2026-04-15) | yes |
|
|
167
168
|
| 0.27.x (2026-05-07) | 2.14.0 (2026-04-01) | yes |
|
|
168
169
|
| 0.26.x (2026-03-30) | 2.13.2 (2026-03-02) | yes |
|
data/docker-compose-ssl.yml
CHANGED
data/docker-compose.yml
CHANGED
data/ext/librdkafka.so
CHANGED
|
Binary file
|
|
@@ -14,9 +14,16 @@ module Rdkafka
|
|
|
14
14
|
|
|
15
15
|
# Registry for registering all the handles.
|
|
16
16
|
REGISTRY = {}
|
|
17
|
+
# Guards REGISTRY mutations. The registry is shared across producing/consuming threads and the
|
|
18
|
+
# background polling thread (which removes handles from FFI callbacks), so the Hash must not be
|
|
19
|
+
# mutated concurrently. This is effectively safe on MRI under the GVL but not on JRuby, where a
|
|
20
|
+
# lost write could leave a handle unregistered (never unlocked -> `wait` times out for a
|
|
21
|
+
# delivered message) or never removed (permanent leak).
|
|
22
|
+
REGISTRY_MUTEX = Mutex.new
|
|
17
23
|
# Default wait timeout is 31 years
|
|
18
24
|
MAX_WAIT_TIMEOUT_FOREVER = 10_000_000_000
|
|
19
25
|
|
|
26
|
+
private_constant :REGISTRY_MUTEX
|
|
20
27
|
private_constant :MAX_WAIT_TIMEOUT_FOREVER
|
|
21
28
|
|
|
22
29
|
class << self
|
|
@@ -25,17 +32,28 @@ module Rdkafka
|
|
|
25
32
|
# @param handle [AbstractHandle] any handle we want to register
|
|
26
33
|
def register(handle)
|
|
27
34
|
address = handle.to_ptr.address
|
|
28
|
-
REGISTRY[address] = handle
|
|
35
|
+
REGISTRY_MUTEX.synchronize { REGISTRY[address] = handle }
|
|
29
36
|
end
|
|
30
37
|
|
|
31
38
|
# Removes handle from the register based on the handle address
|
|
32
39
|
#
|
|
33
40
|
# @param address [Integer] address of the registered handle we want to remove
|
|
34
41
|
def remove(address)
|
|
35
|
-
REGISTRY.delete(address)
|
|
42
|
+
REGISTRY_MUTEX.synchronize { REGISTRY.delete(address) }
|
|
36
43
|
end
|
|
37
44
|
end
|
|
38
45
|
|
|
46
|
+
# Operation result prepared by the background event callback. Background events are
|
|
47
|
+
# destroyed as soon as the callback returns, so anything the waiting thread needs has to be
|
|
48
|
+
# copied out of event-owned memory into Ruby objects and stored here before `#unlock` runs.
|
|
49
|
+
# When result parsing fails, holds the captured exception so it can be re-raised on the
|
|
50
|
+
# waiting thread.
|
|
51
|
+
attr_accessor :result
|
|
52
|
+
|
|
53
|
+
# Broker-provided error message copied out of event-owned memory by the background event
|
|
54
|
+
# callback, used by `#raise_error`.
|
|
55
|
+
attr_accessor :broker_message
|
|
56
|
+
|
|
39
57
|
def initialize
|
|
40
58
|
@mutex = Thread::Mutex.new
|
|
41
59
|
@resource = Thread::ConditionVariable.new
|
|
@@ -122,6 +140,17 @@ module Rdkafka
|
|
|
122
140
|
raise "Must be implemented by subclass!"
|
|
123
141
|
end
|
|
124
142
|
|
|
143
|
+
# Returns the operation result prepared by the background event callback, re-raising an
|
|
144
|
+
# exception that was captured while the event memory was still readable.
|
|
145
|
+
#
|
|
146
|
+
# @return [Object] operation-specific result
|
|
147
|
+
# @raise [RdkafkaError] when result parsing in the event callback failed
|
|
148
|
+
def prepared_result
|
|
149
|
+
raise(result) if result.is_a?(Exception)
|
|
150
|
+
|
|
151
|
+
result
|
|
152
|
+
end
|
|
153
|
+
|
|
125
154
|
# Allow subclasses to override
|
|
126
155
|
def raise_error
|
|
127
156
|
raise RdkafkaError.new(self[:response])
|
|
@@ -17,12 +17,12 @@ module Rdkafka
|
|
|
17
17
|
@synonyms = []
|
|
18
18
|
|
|
19
19
|
# The code below builds up the config synonyms using same config binding
|
|
20
|
-
pointer_to_size_t = FFI::MemoryPointer.new(:
|
|
20
|
+
pointer_to_size_t = FFI::MemoryPointer.new(:size_t)
|
|
21
21
|
synonym_ptr = Bindings.rd_kafka_ConfigEntry_synonyms(config_ptr, pointer_to_size_t)
|
|
22
22
|
synonyms_ptr = synonym_ptr.read_array_of_pointer(pointer_to_size_t.read_int)
|
|
23
23
|
|
|
24
24
|
(1..pointer_to_size_t.read_int).map do |ar|
|
|
25
|
-
self.class.new
|
|
25
|
+
@synonyms << self.class.new(synonyms_ptr[ar - 1])
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -5,17 +5,18 @@ module Rdkafka
|
|
|
5
5
|
# Handle for create ACL operation
|
|
6
6
|
class CreateAclHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:response_string, :pointer
|
|
8
|
+
:response, :int
|
|
10
9
|
|
|
11
10
|
# @return [String] the name of the operation
|
|
12
11
|
def operation_name
|
|
13
12
|
"create acl"
|
|
14
13
|
end
|
|
15
14
|
|
|
16
|
-
# @return [CreateAclReport]
|
|
15
|
+
# @return [CreateAclReport] report prepared by the background event callback, with
|
|
16
|
+
# rdkafka_response value as 0 and rdkafka_response_string value as empty string if the
|
|
17
|
+
# acl creation was successful
|
|
17
18
|
def create_result
|
|
18
|
-
|
|
19
|
+
prepared_result
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
# Raises an error if the operation failed
|
|
@@ -23,7 +24,7 @@ module Rdkafka
|
|
|
23
24
|
def raise_error
|
|
24
25
|
raise RdkafkaError.new(
|
|
25
26
|
self[:response],
|
|
26
|
-
broker_message:
|
|
27
|
+
broker_message: broker_message
|
|
27
28
|
)
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -3,18 +3,16 @@ module Rdkafka
|
|
|
3
3
|
# Handle for create partitions operation
|
|
4
4
|
class CreatePartitionsHandle < AbstractHandle
|
|
5
5
|
layout :pending, :bool,
|
|
6
|
-
:response, :int
|
|
7
|
-
:error_string, :pointer,
|
|
8
|
-
:result_name, :pointer
|
|
6
|
+
:response, :int
|
|
9
7
|
|
|
10
8
|
# @return [String] the name of the operation
|
|
11
9
|
def operation_name
|
|
12
10
|
"create partitions"
|
|
13
11
|
end
|
|
14
12
|
|
|
15
|
-
# @return [
|
|
13
|
+
# @return [CreatePartitionsReport] report prepared by the background event callback
|
|
16
14
|
def create_result
|
|
17
|
-
|
|
15
|
+
prepared_result
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
# Raises an error if the operation failed
|
|
@@ -22,7 +20,7 @@ module Rdkafka
|
|
|
22
20
|
def raise_error
|
|
23
21
|
raise RdkafkaError.new(
|
|
24
22
|
self[:response],
|
|
25
|
-
broker_message:
|
|
23
|
+
broker_message: broker_message
|
|
26
24
|
)
|
|
27
25
|
end
|
|
28
26
|
end
|
|
@@ -5,18 +5,16 @@ module Rdkafka
|
|
|
5
5
|
# Handle for create topic operation
|
|
6
6
|
class CreateTopicHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:error_string, :pointer,
|
|
10
|
-
:result_name, :pointer
|
|
8
|
+
:response, :int
|
|
11
9
|
|
|
12
10
|
# @return [String] the name of the operation
|
|
13
11
|
def operation_name
|
|
14
12
|
"create topic"
|
|
15
13
|
end
|
|
16
14
|
|
|
17
|
-
# @return [
|
|
15
|
+
# @return [CreateTopicReport] report prepared by the background event callback
|
|
18
16
|
def create_result
|
|
19
|
-
|
|
17
|
+
prepared_result
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
# Raises an error if the operation failed
|
|
@@ -24,7 +22,7 @@ module Rdkafka
|
|
|
24
22
|
def raise_error
|
|
25
23
|
raise RdkafkaError.new(
|
|
26
24
|
self[:response],
|
|
27
|
-
broker_message:
|
|
25
|
+
broker_message: broker_message
|
|
28
26
|
)
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -5,19 +5,17 @@ module Rdkafka
|
|
|
5
5
|
# Handle for delete ACL operation
|
|
6
6
|
class DeleteAclHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:response_string, :pointer,
|
|
10
|
-
:matching_acls, :pointer,
|
|
11
|
-
:matching_acls_count, :int
|
|
8
|
+
:response, :int
|
|
12
9
|
|
|
13
10
|
# @return [String] the name of the operation
|
|
14
11
|
def operation_name
|
|
15
12
|
"delete acl"
|
|
16
13
|
end
|
|
17
14
|
|
|
18
|
-
# @return [DeleteAclReport]
|
|
15
|
+
# @return [DeleteAclReport] report prepared by the background event callback, with an
|
|
16
|
+
# array of matching_acls
|
|
19
17
|
def create_result
|
|
20
|
-
|
|
18
|
+
prepared_result
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
# Raises an error if the operation failed
|
|
@@ -25,7 +23,7 @@ module Rdkafka
|
|
|
25
23
|
def raise_error
|
|
26
24
|
raise RdkafkaError.new(
|
|
27
25
|
self[:response],
|
|
28
|
-
broker_message:
|
|
26
|
+
broker_message: broker_message
|
|
29
27
|
)
|
|
30
28
|
end
|
|
31
29
|
end
|
|
@@ -4,10 +4,8 @@ module Rdkafka
|
|
|
4
4
|
class Admin
|
|
5
5
|
# Handle for delete groups operation
|
|
6
6
|
class DeleteGroupsHandle < AbstractHandle
|
|
7
|
-
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:error_string, :pointer,
|
|
10
|
-
:result_name, :pointer
|
|
7
|
+
layout :pending, :bool,
|
|
8
|
+
:response, :int
|
|
11
9
|
|
|
12
10
|
# @return [String] the name of the operation
|
|
13
11
|
def operation_name
|
|
@@ -17,7 +15,7 @@ module Rdkafka
|
|
|
17
15
|
# Creates the result report
|
|
18
16
|
# @return [DeleteGroupsReport]
|
|
19
17
|
def create_result
|
|
20
|
-
|
|
18
|
+
prepared_result
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
# Raises an error if the operation failed
|
|
@@ -25,7 +23,7 @@ module Rdkafka
|
|
|
25
23
|
def raise_error
|
|
26
24
|
raise RdkafkaError.new(
|
|
27
25
|
self[:response],
|
|
28
|
-
broker_message:
|
|
26
|
+
broker_message: broker_message
|
|
29
27
|
)
|
|
30
28
|
end
|
|
31
29
|
end
|
|
@@ -5,18 +5,16 @@ module Rdkafka
|
|
|
5
5
|
# Handle for delete topic operation
|
|
6
6
|
class DeleteTopicHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:error_string, :pointer,
|
|
10
|
-
:result_name, :pointer
|
|
8
|
+
:response, :int
|
|
11
9
|
|
|
12
10
|
# @return [String] the name of the operation
|
|
13
11
|
def operation_name
|
|
14
12
|
"delete topic"
|
|
15
13
|
end
|
|
16
14
|
|
|
17
|
-
# @return [
|
|
15
|
+
# @return [DeleteTopicReport] report prepared by the background event callback
|
|
18
16
|
def create_result
|
|
19
|
-
|
|
17
|
+
prepared_result
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
# Raises an error if the operation failed
|
|
@@ -24,7 +22,7 @@ module Rdkafka
|
|
|
24
22
|
def raise_error
|
|
25
23
|
raise RdkafkaError.new(
|
|
26
24
|
self[:response],
|
|
27
|
-
broker_message:
|
|
25
|
+
broker_message: broker_message
|
|
28
26
|
)
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -5,19 +5,17 @@ module Rdkafka
|
|
|
5
5
|
# Handle for describe ACL operation
|
|
6
6
|
class DescribeAclHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:response_string, :pointer,
|
|
10
|
-
:acls, :pointer,
|
|
11
|
-
:acls_count, :int
|
|
8
|
+
:response, :int
|
|
12
9
|
|
|
13
10
|
# @return [String] the name of the operation.
|
|
14
11
|
def operation_name
|
|
15
12
|
"describe acl"
|
|
16
13
|
end
|
|
17
14
|
|
|
18
|
-
# @return [DescribeAclReport]
|
|
15
|
+
# @return [DescribeAclReport] report prepared by the background event callback, with an
|
|
16
|
+
# array of acls that matches the request filters.
|
|
19
17
|
def create_result
|
|
20
|
-
|
|
18
|
+
prepared_result
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
# Raises an error if the operation failed
|
|
@@ -25,7 +23,7 @@ module Rdkafka
|
|
|
25
23
|
def raise_error
|
|
26
24
|
raise RdkafkaError.new(
|
|
27
25
|
self[:response],
|
|
28
|
-
broker_message:
|
|
26
|
+
broker_message: broker_message
|
|
29
27
|
)
|
|
30
28
|
end
|
|
31
29
|
end
|
|
@@ -5,22 +5,16 @@ module Rdkafka
|
|
|
5
5
|
# Handle for describe configs operation
|
|
6
6
|
class DescribeConfigsHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:response_string, :pointer,
|
|
10
|
-
:config_entries, :pointer,
|
|
11
|
-
:entry_count, :int
|
|
8
|
+
:response, :int
|
|
12
9
|
|
|
13
10
|
# @return [String] the name of the operation.
|
|
14
11
|
def operation_name
|
|
15
12
|
"describe configs"
|
|
16
13
|
end
|
|
17
14
|
|
|
18
|
-
# @return [
|
|
15
|
+
# @return [DescribeConfigsReport] report prepared by the background event callback
|
|
19
16
|
def create_result
|
|
20
|
-
|
|
21
|
-
config_entries: self[:config_entries],
|
|
22
|
-
entry_count: self[:entry_count]
|
|
23
|
-
)
|
|
17
|
+
prepared_result
|
|
24
18
|
end
|
|
25
19
|
|
|
26
20
|
# Raises an error if the operation failed
|
|
@@ -28,7 +22,7 @@ module Rdkafka
|
|
|
28
22
|
def raise_error
|
|
29
23
|
raise RdkafkaError.new(
|
|
30
24
|
self[:response],
|
|
31
|
-
broker_message:
|
|
25
|
+
broker_message: broker_message
|
|
32
26
|
)
|
|
33
27
|
end
|
|
34
28
|
end
|
|
@@ -19,7 +19,7 @@ module Rdkafka
|
|
|
19
19
|
.each do |config_resource_result_ptr|
|
|
20
20
|
config_resource_result = ConfigResourceBindingResult.new(config_resource_result_ptr)
|
|
21
21
|
|
|
22
|
-
pointer_to_size_t = FFI::MemoryPointer.new(:
|
|
22
|
+
pointer_to_size_t = FFI::MemoryPointer.new(:size_t)
|
|
23
23
|
configs_ptr = Bindings.rd_kafka_ConfigResource_configs(
|
|
24
24
|
config_resource_result_ptr,
|
|
25
25
|
pointer_to_size_t
|
|
@@ -32,10 +32,6 @@ module Rdkafka
|
|
|
32
32
|
|
|
33
33
|
@resources << config_resource_result
|
|
34
34
|
end
|
|
35
|
-
ensure
|
|
36
|
-
return if config_entries == FFI::Pointer::NULL
|
|
37
|
-
|
|
38
|
-
Bindings.rd_kafka_ConfigResource_destroy_array(config_entries, entry_count)
|
|
39
35
|
end
|
|
40
36
|
|
|
41
37
|
private
|
|
@@ -5,22 +5,16 @@ module Rdkafka
|
|
|
5
5
|
# Handle for incremental alter configs operation
|
|
6
6
|
class IncrementalAlterConfigsHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:response_string, :pointer,
|
|
10
|
-
:config_entries, :pointer,
|
|
11
|
-
:entry_count, :int
|
|
8
|
+
:response, :int
|
|
12
9
|
|
|
13
10
|
# @return [String] the name of the operation.
|
|
14
11
|
def operation_name
|
|
15
12
|
"incremental alter configs"
|
|
16
13
|
end
|
|
17
14
|
|
|
18
|
-
# @return [
|
|
15
|
+
# @return [IncrementalAlterConfigsReport] report prepared by the background event callback
|
|
19
16
|
def create_result
|
|
20
|
-
|
|
21
|
-
config_entries: self[:config_entries],
|
|
22
|
-
entry_count: self[:entry_count]
|
|
23
|
-
)
|
|
17
|
+
prepared_result
|
|
24
18
|
end
|
|
25
19
|
|
|
26
20
|
# Raises an error if the operation failed
|
|
@@ -28,7 +22,7 @@ module Rdkafka
|
|
|
28
22
|
def raise_error
|
|
29
23
|
raise RdkafkaError.new(
|
|
30
24
|
self[:response],
|
|
31
|
-
broker_message:
|
|
25
|
+
broker_message: broker_message
|
|
32
26
|
)
|
|
33
27
|
end
|
|
34
28
|
end
|
|
@@ -19,7 +19,7 @@ module Rdkafka
|
|
|
19
19
|
.each do |config_resource_result_ptr|
|
|
20
20
|
config_resource_result = ConfigResourceBindingResult.new(config_resource_result_ptr)
|
|
21
21
|
|
|
22
|
-
pointer_to_size_t = FFI::MemoryPointer.new(:
|
|
22
|
+
pointer_to_size_t = FFI::MemoryPointer.new(:size_t)
|
|
23
23
|
configs_ptr = Bindings.rd_kafka_ConfigResource_configs(
|
|
24
24
|
config_resource_result_ptr,
|
|
25
25
|
pointer_to_size_t
|
|
@@ -32,10 +32,6 @@ module Rdkafka
|
|
|
32
32
|
|
|
33
33
|
@resources << config_resource_result
|
|
34
34
|
end
|
|
35
|
-
ensure
|
|
36
|
-
return if config_entries == FFI::Pointer::NULL
|
|
37
|
-
|
|
38
|
-
Bindings.rd_kafka_ConfigResource_destroy_array(config_entries, entry_count)
|
|
39
35
|
end
|
|
40
36
|
|
|
41
37
|
private
|
|
@@ -5,22 +5,17 @@ module Rdkafka
|
|
|
5
5
|
# Handle for list offsets operation
|
|
6
6
|
class ListOffsetsHandle < AbstractHandle
|
|
7
7
|
layout :pending, :bool,
|
|
8
|
-
:response, :int
|
|
9
|
-
:response_string, :pointer,
|
|
10
|
-
:result_infos, :pointer,
|
|
11
|
-
:result_count, :int
|
|
8
|
+
:response, :int
|
|
12
9
|
|
|
13
10
|
# @return [String] the name of the operation.
|
|
14
11
|
def operation_name
|
|
15
12
|
"list offsets"
|
|
16
13
|
end
|
|
17
14
|
|
|
18
|
-
# @return [ListOffsetsReport]
|
|
15
|
+
# @return [ListOffsetsReport] report prepared by the background event callback, with
|
|
16
|
+
# partition offset information.
|
|
19
17
|
def create_result
|
|
20
|
-
|
|
21
|
-
result_infos: self[:result_infos],
|
|
22
|
-
result_count: self[:result_count]
|
|
23
|
-
)
|
|
18
|
+
prepared_result
|
|
24
19
|
end
|
|
25
20
|
|
|
26
21
|
# Raises an error if the operation failed
|
|
@@ -28,7 +23,7 @@ module Rdkafka
|
|
|
28
23
|
def raise_error
|
|
29
24
|
raise RdkafkaError.new(
|
|
30
25
|
self[:response],
|
|
31
|
-
broker_message:
|
|
26
|
+
broker_message: broker_message
|
|
32
27
|
)
|
|
33
28
|
end
|
|
34
29
|
end
|