karafka-rdkafka 0.27.2-aarch64-linux-gnu → 0.28.1-aarch64-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 +41 -1
- data/README.md +4 -3
- data/docker-compose-ssl.yml +1 -1
- data/docker-compose.yml +1 -1
- data/ext/librdkafka.so +0 -0
- data/karafka-rdkafka.gemspec +1 -0
- data/lib/rdkafka/abstract_handle.rb +37 -4
- data/lib/rdkafka/admin/config_binding_result.rb +1 -1
- data/lib/rdkafka/admin/create_acl_handle.rb +2 -8
- data/lib/rdkafka/admin/create_acl_report.rb +2 -1
- data/lib/rdkafka/admin/create_partitions_handle.rb +1 -20
- data/lib/rdkafka/admin/create_topic_handle.rb +1 -20
- data/lib/rdkafka/admin/delete_acl_handle.rb +2 -10
- data/lib/rdkafka/admin/delete_groups_handle.rb +3 -11
- data/lib/rdkafka/admin/delete_records_handle.rb +31 -0
- data/lib/rdkafka/admin/delete_records_report.rb +25 -0
- data/lib/rdkafka/admin/delete_topic_handle.rb +1 -20
- data/lib/rdkafka/admin/describe_acl_handle.rb +2 -10
- data/lib/rdkafka/admin/describe_acl_report.rb +2 -1
- data/lib/rdkafka/admin/describe_configs_handle.rb +2 -13
- data/lib/rdkafka/admin/describe_configs_report.rb +5 -6
- data/lib/rdkafka/admin/incremental_alter_configs_handle.rb +2 -13
- data/lib/rdkafka/admin/incremental_alter_configs_report.rb +5 -6
- data/lib/rdkafka/admin/list_consumer_groups_handle.rb +31 -0
- data/lib/rdkafka/admin/list_consumer_groups_report.rb +83 -0
- data/lib/rdkafka/admin/list_offsets_handle.rb +2 -13
- data/lib/rdkafka/admin/list_offsets_report.rb +5 -2
- data/lib/rdkafka/admin.rb +233 -145
- data/lib/rdkafka/bindings.rb +63 -16
- 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_records_handler.rb +38 -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_consumer_groups_handler.rb +39 -0
- data/lib/rdkafka/callbacks/list_offsets_handler.rb +42 -0
- data/lib/rdkafka/callbacks.rb +60 -246
- data/lib/rdkafka/config.rb +69 -50
- data/lib/rdkafka/consumer/headers.rb +19 -5
- data/lib/rdkafka/consumer/topic_partition_list.rb +57 -42
- data/lib/rdkafka/consumer.rb +190 -48
- data/lib/rdkafka/defaults.rb +32 -3
- data/lib/rdkafka/error.rb +14 -5
- data/lib/rdkafka/helpers/list_offsets.rb +127 -0
- data/lib/rdkafka/helpers/metadata.rb +29 -0
- data/lib/rdkafka/helpers/oauth.rb +10 -5
- data/lib/rdkafka/metadata.rb +84 -19
- data/lib/rdkafka/native_kafka.rb +20 -7
- data/lib/rdkafka/producer/delivery_handle.rb +4 -5
- data/lib/rdkafka/producer/partitions_count_cache.rb +24 -38
- data/lib/rdkafka/producer/testing.rb +2 -1
- data/lib/rdkafka/producer.rb +100 -71
- data/lib/rdkafka/version.rb +3 -3
- data/lib/rdkafka.rb +19 -0
- data/package-lock.json +6 -6
- data/renovate.json +11 -1
- metadata +21 -5
- 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: cb6dd6580bf5c14ddceaa2ccd38deaad34cf4e6e81e994c82df73e62fb831f77
|
|
4
|
+
data.tar.gz: c26f74ea68b3c14ace182f7f8b2da1184cceb59d6063b044a7efb3a84a022eef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b954711968c6acaa5beffa2995a33262bef8e2297b18eb3d9e828dd0be43818bfa5be73a7a20bfe13a8d19ee08ec4436e38e7b63a69948f3b85b7d06843d5db
|
|
7
|
+
data.tar.gz: f2003f4f608143b78dd9caab59a30d2fd96b5ed1a280ea9d1388cb4d5ff386d26655f2b0b3e15ec16b450b7df23118cfae1f1f99f229139e19243cd6bb7f3d5c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
# Rdkafka Changelog
|
|
2
2
|
|
|
3
|
+
## v0.28.1 (2026-09-04)
|
|
4
|
+
- [Enhancement] Add `Admin#delete_records`, wrapping librdkafka's `DeleteRecords` admin API. Deletes all messages in a partition up to (but not including) a given offset - accepts an integer offset or `:end` to clear all current data. Ported from rdkafka-ruby (#956).
|
|
5
|
+
- [Enhancement] Add `Admin#list_consumer_groups`, wrapping librdkafka's `ListConsumerGroups` admin API. Returns a cluster-wide listing of consumer groups (`group_id`, `is_simple_consumer_group`, state) plus any per-broker errors. Ported from rdkafka-ruby (#955).
|
|
6
|
+
- [Fix] Make `NativeKafka#close` fork-aware so a forked child no longer segfaults on exit. Handles record their creator pid and skip the native teardown in any other process.
|
|
7
|
+
- [Fix] Stabilize the flaky partitions count cache statistics spec.
|
|
8
|
+
- [Fix] Stabilize the `to_native_tpl` leak integration spec against RSS measurement noise.
|
|
9
|
+
|
|
10
|
+
## v0.28.0 (2026-07-12)
|
|
11
|
+
- [Enhancement] Bump librdkafka to `2.14.2`. Maintenance release: fixes duplicate groups in `ListConsumerGroups` when multiple brokers return the same group, a data race in timers, and bumps bundled OpenSSL/libcurl/zstd/zlib/cJSON dependencies (several CVEs).
|
|
12
|
+
- [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.
|
|
13
|
+
- [Enhancement] Name the failing partition and topic in the `RdkafkaError` raised for per-partition `list_offsets` errors (previously a bare error code), preserving the per-partition context the pre-batching `Consumer#lag` watermark errors carried.
|
|
14
|
+
- [Enhancement] Add `Consumer#list_offsets`, mirroring `Admin#list_offsets`, so offsets can be queried on an existing consumer handle without a dedicated admin connection, and rebuild `Consumer#lag` on top of it as one batched query instead of a roundtrip per partition.
|
|
15
|
+
- [Enhancement] Extract the admin background-event result handlers into one class per operation under `lib/rdkafka/callbacks/`. Internal reorganization with no API or behavior change.
|
|
16
|
+
- [Enhancement] Expose `replicas` and `isrs` (in-sync replica broker ids) on each partition in topic metadata; both were previously dropped from the `Metadata#topics` partition hashes.
|
|
17
|
+
- [Enhancement] Reuse per-thread scratch pointers in `Consumer::Headers.from_native`, removing the per-message native allocations from the consumer hot path.
|
|
18
|
+
- [Enhancement] Remove the unused `DeliveryHandle` `:topic_name` struct field and its per-message allocation. Use `DeliveryHandle#topic` or `DeliveryReport#topic_name`, both unchanged.
|
|
19
|
+
- [Fix] Stop `poll_batch`/`poll_batch_nb` from discarding a whole batch when one message fails to build. The failure is now surfaced inline as an `RdkafkaError` in the returned array, preserving the rest of the batch.
|
|
20
|
+
- [Fix] Add the missing `closed_consumer_check` to `Consumer#position`, so it raises a consistent `ClosedConsumerError` like every sibling offset method.
|
|
21
|
+
- [Fix] Stop leaking the native `rd_kafka_topic_conf_t` in `Producer#set_topic_config` when a per-topic config value is rejected.
|
|
22
|
+
- [Fix] Raise instead of silently dropping a rejected `incremental_alter_configs` entry, which previously left the alter request reporting success.
|
|
23
|
+
- [Fix] Let `PartitionsCountCache` adopt a lower partition count once the cached entry has expired, so a topic recreated with fewer partitions no longer fails `produce` until process restart.
|
|
24
|
+
- [Fix] Make the `Consumer` GC finalizer close the consumer and destroy its consumer queue, not just the native client, preventing a hang or leak when a consumer is collected without an explicit `close`.
|
|
25
|
+
- [Fix] Stop `describe_configs`, `incremental_alter_configs` and `list_offsets` from leaking handles and native resources when their arguments are rejected; all three now validate input before allocating.
|
|
26
|
+
- [Fix] Destroy the native topic-partition list in `TopicPartitionList#to_native_tpl` when population fails partway, which previously leaked the half-built list.
|
|
27
|
+
- [Fix] Allocate the admin result-count out-parameter as `:size_t` instead of `:int32`, fixing a 4-byte overflow on every admin result parse.
|
|
28
|
+
- [Fix] Destroy admin API background events after processing; they were never destroyed, so every admin operation leaked its whole result event. The internal FFI struct fields on admin handles were removed as part of this - use `handle.wait` and the returned report objects, whose interfaces are unchanged.
|
|
29
|
+
- [Fix] Resolve admin operation handles from the event error when an operation fails at the operation level (e.g. brokers unreachable), instead of blocking until `wait` timed out and discarding the real error.
|
|
30
|
+
- [Fix] Stop leaking the native `rd_kafka_conf_t` when client creation fails, a multi-KB leak per failed attempt for supervisors retrying on transient SASL/SSL misconfiguration.
|
|
31
|
+
- [Fix] Stop `Metadata` from leaking the native metadata struct on every retried fetch; each attempt now frees its own native resources.
|
|
32
|
+
- [Fix] Free the librdkafka-allocated string in `Consumer#cluster_id` and `Consumer#member_id`, and fix the `rd_kafka_clusterid` arity. `Consumer#cluster_id` now accepts a `timeout_ms`.
|
|
33
|
+
- [Fix] Guard the message delivery callback so a raising user `delivery_callback` can no longer leave the handle locked or crash the producer; exceptions are now logged and swallowed.
|
|
34
|
+
- [Fix] Stop `Producer#produce` from orphaning the delivery handle in the process-global registry when it fails after registering it.
|
|
35
|
+
- [Fix] Attach `rd_kafka_query_watermark_offsets` with `blocking: true` so it releases the GVL; it previously froze every other Ruby thread for up to `timeout_ms`.
|
|
36
|
+
- [Fix] Stabilize the flaky `Consumer#lag` spec on overloaded CI. Backported from rdkafka-ruby (#912).
|
|
37
|
+
- [Fix] Fix the NULL background-queue cleanup branches in `Admin#delete_group`, `Admin#delete_acl` and `Admin#describe_acl`, which raised a `NameError` and leaked the native request object instead of raising `ConfigError`.
|
|
38
|
+
- [Fix] Forward `broker_message` and `instance_name` through `RdkafkaError.build`; both were previously discarded on the `rd_kafka_error_t` pointer path.
|
|
39
|
+
- [Fix] Synchronize `AbstractHandle::REGISTRY` mutations with a mutex, which could otherwise lose a write on JRuby and leave a handle unregistered or leaked.
|
|
40
|
+
- [Fix] Stop the `Metadata` retry loop from clobbering the request timeout and blocking for minutes. The request timeout is left unchanged across retries, the backoff is capped, and the loop is bounded by a ~5s wall-clock budget after a floor of 3 attempts.
|
|
41
|
+
- [Fix] Cache the partition count for a missing topic, so `produce` with a `partition_key` to a not-yet-created topic no longer runs a blocking metadata query on every message.
|
|
42
|
+
|
|
3
43
|
## 0.27.2 (2026-05-21)
|
|
4
44
|
- [Enhancement] `poll_batch` and `poll_batch_nb` now return error events inline as `RdkafkaError` objects rather than raising on the first error. The return type is `Array<Message, RdkafkaError>` and callers are responsible for handling errors in the result.
|
|
5
45
|
|
|
6
46
|
## 0.27.1 (2026-05-14)
|
|
7
|
-
- [Fix] `poll_nb`, `poll_nb_each`, `poll_batch
|
|
47
|
+
- [Fix] `poll_nb`, `poll_nb_each`, `poll_batch` and `poll_batch_nb` now raise `RdkafkaError` with `details` populated (`{topic:, partition:, offset:}`) when a message contains an error, consistent with `poll`.
|
|
8
48
|
|
|
9
49
|
## 0.27.0 (2026-05-08)
|
|
10
50
|
- [Feature] Add `Consumer#poll_batch(timeout_ms, max_items:)` and `Consumer#poll_batch_nb(timeout_ms, max_items:)` for batch message polling via `rd_kafka_consume_batch_queue` (from upstream).
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Karafka-Rdkafka
|
|
2
2
|
|
|
3
|
-
[](https://github.com/karafka/karafka-rdkafka/actions/workflows/
|
|
3
|
+
[](https://github.com/karafka/karafka-rdkafka/actions/workflows/ci_linux_ubuntu_x86_64_gnu.yml)
|
|
4
4
|
[](https://badge.fury.io/rb/karafka-rdkafka)
|
|
5
5
|
[](https://slack.karafka.io)
|
|
6
6
|
|
|
@@ -61,13 +61,14 @@ Contributions should generally be made to the upstream [rdkafka-ruby repository]
|
|
|
61
61
|
|
|
62
62
|
## Versions
|
|
63
63
|
|
|
64
|
-
| rdkafka
|
|
64
|
+
| karafka-rdkafka | librdkafka | patches |
|
|
65
65
|
|-|-|-|
|
|
66
|
+
| 0.28.x (2026-07-12) | 2.14.2 (2026-06-03) | yes |
|
|
66
67
|
| 0.27.x (2026-05-08) | 2.14.1 (2026-04-15) | yes |
|
|
67
68
|
| 0.26.x (2026-04-11) | 2.14.0 (2026-04-01) | yes |
|
|
68
69
|
| 0.25.x (2026-04-02) | 2.13.2 (2026-03-02) | yes |
|
|
69
70
|
| 0.24.x (2026-02-25) | 2.13.0 (2026-01-05) | yes |
|
|
70
|
-
| 0.23.x (2025-11-01) | 2.12.1 (2025-10-
|
|
71
|
+
| 0.23.x (2025-11-01) | 2.12.1 (2025-10-21) | yes |
|
|
71
72
|
| 0.22.x (2025-09-26) | 2.11.1 (2025-08-18) | yes |
|
|
72
73
|
| 0.21.x (2025-08-18) | 2.11.0 (2025-07-03) | yes |
|
|
73
74
|
| 0.20.x (2025-07-17) | 2.8.0 (2025-01-07) | yes |
|
data/docker-compose-ssl.yml
CHANGED
data/docker-compose.yml
CHANGED
data/ext/librdkafka.so
CHANGED
|
Binary file
|
data/karafka-rdkafka.gemspec
CHANGED
|
@@ -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
|
|
@@ -118,13 +136,28 @@ module Rdkafka
|
|
|
118
136
|
end
|
|
119
137
|
|
|
120
138
|
# @return [Object] operation-specific result
|
|
139
|
+
#
|
|
140
|
+
# Defaults to the result prepared by the background event callback (see
|
|
141
|
+
# {#prepared_result}). Subclasses backed by a synchronous callback that writes the result
|
|
142
|
+
# into struct fields (e.g. {Producer::DeliveryHandle}) override this.
|
|
121
143
|
def create_result
|
|
122
|
-
|
|
144
|
+
prepared_result
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Returns the operation result prepared by the background event callback, re-raising an
|
|
148
|
+
# exception that was captured while the event memory was still readable
|
|
149
|
+
#
|
|
150
|
+
# @return [Object] operation-specific result
|
|
151
|
+
# @raise [RdkafkaError] when result parsing in the event callback failed
|
|
152
|
+
def prepared_result
|
|
153
|
+
raise(result) if result.is_a?(Exception)
|
|
154
|
+
|
|
155
|
+
result
|
|
123
156
|
end
|
|
124
157
|
|
|
125
158
|
# Allow subclasses to override
|
|
126
159
|
def raise_error
|
|
127
|
-
RdkafkaError.validate!(self[:response])
|
|
160
|
+
RdkafkaError.validate!(self[:response], broker_message: broker_message)
|
|
128
161
|
end
|
|
129
162
|
|
|
130
163
|
# Error that is raised when waiting for the handle to complete
|
|
@@ -17,7 +17,7 @@ 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
|
|
|
@@ -5,25 +5,19 @@ 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] instance with rdkafka_response value as 0 and rdkafka_response_string value as empty string if the acl creation was successful
|
|
17
|
-
def create_result
|
|
18
|
-
CreateAclReport.new(rdkafka_response: self[:response], rdkafka_response_string: self[:response_string])
|
|
19
|
-
end
|
|
20
|
-
|
|
21
15
|
# Raises an error if the operation failed
|
|
22
16
|
# @raise [RdkafkaError]
|
|
23
17
|
def raise_error
|
|
24
18
|
raise RdkafkaError.new(
|
|
25
19
|
self[:response],
|
|
26
|
-
broker_message:
|
|
20
|
+
broker_message: broker_message
|
|
27
21
|
)
|
|
28
22
|
end
|
|
29
23
|
end
|
|
@@ -4,7 +4,8 @@ module Rdkafka
|
|
|
4
4
|
class Admin
|
|
5
5
|
# Report for create ACL operation result
|
|
6
6
|
class CreateAclReport
|
|
7
|
-
# Upon successful creation of Acl RD_KAFKA_RESP_ERR_NO_ERROR - 0 is returned as
|
|
7
|
+
# Upon successful creation of Acl RD_KAFKA_RESP_ERR_NO_ERROR - 0 is returned as
|
|
8
|
+
# rdkafka_response
|
|
8
9
|
# @return [Integer]
|
|
9
10
|
attr_reader :rdkafka_response
|
|
10
11
|
|
|
@@ -3,31 +3,12 @@ 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
|
-
|
|
15
|
-
# @return [Boolean] whether the create topic was successful
|
|
16
|
-
def create_result
|
|
17
|
-
CreatePartitionsReport.new(self[:error_string], self[:result_name])
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Raises an error if the operation failed
|
|
21
|
-
# @raise [RdkafkaError]
|
|
22
|
-
def raise_error
|
|
23
|
-
RdkafkaError.validate!(
|
|
24
|
-
self[:response],
|
|
25
|
-
broker_message: CreatePartitionsReport.new(
|
|
26
|
-
self[:error_string],
|
|
27
|
-
self[:result_name]
|
|
28
|
-
).error_string
|
|
29
|
-
)
|
|
30
|
-
end
|
|
31
12
|
end
|
|
32
13
|
end
|
|
33
14
|
end
|
|
@@ -5,31 +5,12 @@ 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
|
-
|
|
17
|
-
# @return [Boolean] whether the create topic was successful
|
|
18
|
-
def create_result
|
|
19
|
-
CreateTopicReport.new(self[:error_string], self[:result_name])
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Raises an error if the operation failed
|
|
23
|
-
# @raise [RdkafkaError]
|
|
24
|
-
def raise_error
|
|
25
|
-
RdkafkaError.validate!(
|
|
26
|
-
self[:response],
|
|
27
|
-
broker_message: CreateTopicReport.new(
|
|
28
|
-
self[:error_string],
|
|
29
|
-
self[:result_name]
|
|
30
|
-
).error_string
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
14
|
end
|
|
34
15
|
end
|
|
35
16
|
end
|
|
@@ -5,27 +5,19 @@ 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] instance with an array of matching_acls
|
|
19
|
-
def create_result
|
|
20
|
-
DeleteAclReport.new(matching_acls: self[:matching_acls], matching_acls_count: self[:matching_acls_count])
|
|
21
|
-
end
|
|
22
|
-
|
|
23
15
|
# Raises an error if the operation failed
|
|
24
16
|
# @raise [RdkafkaError]
|
|
25
17
|
def raise_error
|
|
26
18
|
raise RdkafkaError.new(
|
|
27
19
|
self[:response],
|
|
28
|
-
broker_message:
|
|
20
|
+
broker_message: broker_message
|
|
29
21
|
)
|
|
30
22
|
end
|
|
31
23
|
end
|
|
@@ -4,28 +4,20 @@ 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
|
|
14
12
|
"delete groups"
|
|
15
13
|
end
|
|
16
14
|
|
|
17
|
-
# Creates the result report
|
|
18
|
-
# @return [DeleteGroupsReport]
|
|
19
|
-
def create_result
|
|
20
|
-
DeleteGroupsReport.new(self[:error_string], self[:result_name])
|
|
21
|
-
end
|
|
22
|
-
|
|
23
15
|
# Raises an error if the operation failed
|
|
24
16
|
# @raise [RdkafkaError]
|
|
25
17
|
def raise_error
|
|
26
18
|
raise RdkafkaError.new(
|
|
27
19
|
self[:response],
|
|
28
|
-
broker_message:
|
|
20
|
+
broker_message: broker_message
|
|
29
21
|
)
|
|
30
22
|
end
|
|
31
23
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rdkafka
|
|
4
|
+
class Admin
|
|
5
|
+
# Handle for delete records operation
|
|
6
|
+
class DeleteRecordsHandle < AbstractHandle
|
|
7
|
+
layout :pending, :bool,
|
|
8
|
+
:response, :int
|
|
9
|
+
|
|
10
|
+
# @return [String] the name of the operation
|
|
11
|
+
def operation_name
|
|
12
|
+
"delete records"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @return [DeleteRecordsReport] report prepared by the background event callback, with the
|
|
16
|
+
# post-deletion low-watermark offsets (or per-partition errors)
|
|
17
|
+
def create_result
|
|
18
|
+
prepared_result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Raises an error if the operation failed
|
|
22
|
+
# @raise [RdkafkaError]
|
|
23
|
+
def raise_error
|
|
24
|
+
raise RdkafkaError.new(
|
|
25
|
+
self[:response],
|
|
26
|
+
broker_message: broker_message
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rdkafka
|
|
4
|
+
class Admin
|
|
5
|
+
# Report for delete records operation result
|
|
6
|
+
class DeleteRecordsReport
|
|
7
|
+
# Per-partition results. Each partition's `offset` is the post-deletion low-watermark (the
|
|
8
|
+
# smallest available offset of all live replicas) and its `err` carries the per-partition
|
|
9
|
+
# error code, if deletion failed for that partition.
|
|
10
|
+
# @return [Rdkafka::Consumer::TopicPartitionList]
|
|
11
|
+
attr_reader :offsets
|
|
12
|
+
|
|
13
|
+
# @param result_ptr [FFI::Pointer] pointer to the `rd_kafka_DeleteRecords_result_t`
|
|
14
|
+
def initialize(result_ptr)
|
|
15
|
+
@offsets = Rdkafka::Consumer::TopicPartitionList.new
|
|
16
|
+
|
|
17
|
+
return if result_ptr.null?
|
|
18
|
+
|
|
19
|
+
native_tpl = Bindings.rd_kafka_DeleteRecords_result_offsets(result_ptr)
|
|
20
|
+
|
|
21
|
+
@offsets = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(native_tpl)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -5,31 +5,12 @@ 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
|
-
|
|
17
|
-
# @return [Boolean] whether the delete topic was successful
|
|
18
|
-
def create_result
|
|
19
|
-
DeleteTopicReport.new(self[:error_string], self[:result_name])
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Raises an error if the operation failed
|
|
23
|
-
# @raise [RdkafkaError]
|
|
24
|
-
def raise_error
|
|
25
|
-
RdkafkaError.validate!(
|
|
26
|
-
self[:response],
|
|
27
|
-
broker_message: DeleteTopicReport.new(
|
|
28
|
-
self[:error_string],
|
|
29
|
-
self[:result_name]
|
|
30
|
-
).error_string
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
14
|
end
|
|
34
15
|
end
|
|
35
16
|
end
|
|
@@ -5,27 +5,19 @@ 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] instance with an array of acls that matches the request filters.
|
|
19
|
-
def create_result
|
|
20
|
-
DescribeAclReport.new(acls: self[:acls], acls_count: self[:acls_count])
|
|
21
|
-
end
|
|
22
|
-
|
|
23
15
|
# Raises an error if the operation failed
|
|
24
16
|
# @raise [RdkafkaError]
|
|
25
17
|
def raise_error
|
|
26
18
|
raise RdkafkaError.new(
|
|
27
19
|
self[:response],
|
|
28
|
-
broker_message:
|
|
20
|
+
broker_message: broker_message
|
|
29
21
|
)
|
|
30
22
|
end
|
|
31
23
|
end
|
|
@@ -4,7 +4,8 @@ module Rdkafka
|
|
|
4
4
|
class Admin
|
|
5
5
|
# Report for describe ACL operation result
|
|
6
6
|
class DescribeAclReport
|
|
7
|
-
# acls that exists in the cluster for the resource_type, resource_name and pattern_type
|
|
7
|
+
# acls that exists in the cluster for the resource_type, resource_name and pattern_type
|
|
8
|
+
# filters provided in the request.
|
|
8
9
|
# @return [Rdkafka::Bindings::AclBindingResult] array of matching acls.
|
|
9
10
|
attr_reader :acls
|
|
10
11
|
|
|
@@ -5,30 +5,19 @@ 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 [DescribeAclReport] instance with an array of acls that matches the request filters.
|
|
19
|
-
def create_result
|
|
20
|
-
DescribeConfigsReport.new(
|
|
21
|
-
config_entries: self[:config_entries],
|
|
22
|
-
entry_count: self[:entry_count]
|
|
23
|
-
)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
15
|
# Raises an error if the operation failed
|
|
27
16
|
# @raise [RdkafkaError]
|
|
28
17
|
def raise_error
|
|
29
18
|
raise RdkafkaError.new(
|
|
30
19
|
self[:response],
|
|
31
|
-
broker_message:
|
|
20
|
+
broker_message: broker_message
|
|
32
21
|
)
|
|
33
22
|
end
|
|
34
23
|
end
|
|
@@ -6,7 +6,10 @@ module Rdkafka
|
|
|
6
6
|
class DescribeConfigsReport
|
|
7
7
|
attr_reader :resources
|
|
8
8
|
|
|
9
|
-
# @param config_entries [FFI::Pointer] pointer to config entries array
|
|
9
|
+
# @param config_entries [FFI::Pointer] pointer to the event-owned config entries array.
|
|
10
|
+
# It is only read here - the array is destroyed together with the result event by the
|
|
11
|
+
# background event callback, so this report must be built while the event is alive and
|
|
12
|
+
# must copy everything it needs into Ruby objects.
|
|
10
13
|
# @param entry_count [Integer] number of config entries
|
|
11
14
|
def initialize(config_entries:, entry_count:)
|
|
12
15
|
@resources = []
|
|
@@ -19,7 +22,7 @@ module Rdkafka
|
|
|
19
22
|
.each do |config_resource_result_ptr|
|
|
20
23
|
config_resource_result = ConfigResourceBindingResult.new(config_resource_result_ptr)
|
|
21
24
|
|
|
22
|
-
pointer_to_size_t = FFI::MemoryPointer.new(:
|
|
25
|
+
pointer_to_size_t = FFI::MemoryPointer.new(:size_t)
|
|
23
26
|
configs_ptr = Bindings.rd_kafka_ConfigResource_configs(
|
|
24
27
|
config_resource_result_ptr,
|
|
25
28
|
pointer_to_size_t
|
|
@@ -32,10 +35,6 @@ module Rdkafka
|
|
|
32
35
|
|
|
33
36
|
@resources << config_resource_result
|
|
34
37
|
end
|
|
35
|
-
ensure
|
|
36
|
-
return if config_entries == FFI::Pointer::NULL
|
|
37
|
-
|
|
38
|
-
Bindings.rd_kafka_ConfigResource_destroy_array(config_entries, entry_count)
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
private
|
|
@@ -5,30 +5,19 @@ 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 [DescribeAclReport] instance with an array of acls that matches the request filters.
|
|
19
|
-
def create_result
|
|
20
|
-
IncrementalAlterConfigsReport.new(
|
|
21
|
-
config_entries: self[:config_entries],
|
|
22
|
-
entry_count: self[:entry_count]
|
|
23
|
-
)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
15
|
# Raises an error if the operation failed
|
|
27
16
|
# @raise [RdkafkaError]
|
|
28
17
|
def raise_error
|
|
29
18
|
raise RdkafkaError.new(
|
|
30
19
|
self[:response],
|
|
31
|
-
broker_message:
|
|
20
|
+
broker_message: broker_message
|
|
32
21
|
)
|
|
33
22
|
end
|
|
34
23
|
end
|
|
@@ -6,7 +6,10 @@ module Rdkafka
|
|
|
6
6
|
class IncrementalAlterConfigsReport
|
|
7
7
|
attr_reader :resources
|
|
8
8
|
|
|
9
|
-
# @param config_entries [FFI::Pointer] pointer to config entries array
|
|
9
|
+
# @param config_entries [FFI::Pointer] pointer to the event-owned config entries array.
|
|
10
|
+
# It is only read here - the array is destroyed together with the result event by the
|
|
11
|
+
# background event callback, so this report must be built while the event is alive and
|
|
12
|
+
# must copy everything it needs into Ruby objects.
|
|
10
13
|
# @param entry_count [Integer] number of config entries
|
|
11
14
|
def initialize(config_entries:, entry_count:)
|
|
12
15
|
@resources = []
|
|
@@ -19,7 +22,7 @@ module Rdkafka
|
|
|
19
22
|
.each do |config_resource_result_ptr|
|
|
20
23
|
config_resource_result = ConfigResourceBindingResult.new(config_resource_result_ptr)
|
|
21
24
|
|
|
22
|
-
pointer_to_size_t = FFI::MemoryPointer.new(:
|
|
25
|
+
pointer_to_size_t = FFI::MemoryPointer.new(:size_t)
|
|
23
26
|
configs_ptr = Bindings.rd_kafka_ConfigResource_configs(
|
|
24
27
|
config_resource_result_ptr,
|
|
25
28
|
pointer_to_size_t
|
|
@@ -32,10 +35,6 @@ module Rdkafka
|
|
|
32
35
|
|
|
33
36
|
@resources << config_resource_result
|
|
34
37
|
end
|
|
35
|
-
ensure
|
|
36
|
-
return if config_entries == FFI::Pointer::NULL
|
|
37
|
-
|
|
38
|
-
Bindings.rd_kafka_ConfigResource_destroy_array(config_entries, entry_count)
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
private
|