rdkafka 0.28.0 → 0.29.1
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 +42 -0
- data/README.md +3 -2
- data/bin/verify_kafka_warnings +5 -0
- data/dist/{librdkafka-2.14.1.tar.gz → librdkafka-2.14.2.tar.gz} +0 -0
- data/docker-compose-ssl.yml +4 -1
- data/docker-compose.yml +4 -1
- 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_acl_report.rb +2 -1
- 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_records_handle.rb +31 -0
- data/lib/rdkafka/admin/delete_records_report.rb +25 -0
- 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_acl_report.rb +2 -1
- 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_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 +5 -10
- data/lib/rdkafka/admin/list_offsets_report.rb +5 -2
- data/lib/rdkafka/admin.rb +238 -145
- data/lib/rdkafka/bindings.rb +61 -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 +54 -246
- data/lib/rdkafka/config.rb +69 -50
- data/lib/rdkafka/consumer/headers.rb +19 -5
- data/lib/rdkafka/consumer/partition.rb +8 -1
- data/lib/rdkafka/consumer/topic_partition_list.rb +58 -30
- data/lib/rdkafka/consumer.rb +211 -52
- data/lib/rdkafka/defaults.rb +24 -7
- 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 +86 -19
- data/lib/rdkafka/native_kafka.rb +22 -11
- data/lib/rdkafka/producer/delivery_handle.rb +4 -5
- data/lib/rdkafka/producer/partitions_count_cache.rb +24 -38
- data/lib/rdkafka/producer.rb +81 -61
- data/lib/rdkafka/version.rb +3 -3
- data/lib/rdkafka.rb +19 -0
- data/package-lock.json +3 -3
- data/rdkafka.gemspec +1 -0
- metadata +22 -6
- 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: 9df14d82195673f4747cc9a5d20eeb705a547295b1fa25f6554a5f9fac415ff0
|
|
4
|
+
data.tar.gz: d98858ef1d0c6694acd2de1726e0727a17aae1694adf2d75ee9890bdf8608d57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82715ad307088ce3559789b9445c968fb1dcbfa2e87ba70b8e90c786ff92066c37497b8592153e8512ed297706a8499d38e2c04754129390665478a3174bcf0e
|
|
7
|
+
data.tar.gz: 00fd0221b7afde5cf110437d3b83f7672b820b3ebc596d2ad7126c248f31bb89b35d29ced75c24da0a17af2828a2fc4f7feb4397cdcfe6d04bf78882f2ee02b6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Rdkafka Changelog
|
|
2
2
|
|
|
3
|
+
## 0.29.1 (2026-09-04)
|
|
4
|
+
- [Enhancement] Add `Admin#delete_records` to delete all messages in a partition up to a given offset.
|
|
5
|
+
- [Enhancement] Add `Admin#list_consumer_groups` to list the cluster's consumer groups.
|
|
6
|
+
- [Enhancement] Name the failing topic and partition in the `RdkafkaError` raised for per-partition `list_offsets` errors.
|
|
7
|
+
- [Enhancement] Add `Consumer#list_offsets` to query partition offsets on an existing consumer handle without opening a dedicated admin connection.
|
|
8
|
+
- [Fix] Make `NativeKafka#close` fork-aware so a forked child no longer segfaults on exit.
|
|
9
|
+
- [Fix] Stabilize the `to_native_tpl` leak integration spec.
|
|
10
|
+
- [Fix] Stabilize the flaky partitions count cache statistics spec.
|
|
11
|
+
|
|
12
|
+
## 0.29.0 (2026-07-10)
|
|
13
|
+
- [Enhancement] Bump librdkafka to `2.14.2`
|
|
14
|
+
- [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.
|
|
15
|
+
- [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`).
|
|
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] Extract the admin background-event result handlers into one class per operation under `lib/rdkafka/callbacks/`. Internal reorganization with no API or behavior change.
|
|
18
|
+
- [Enhancement] Reuse per-thread scratch pointers in `Consumer::Headers.from_native`, removing the per-message native allocations from the consumer hot path.
|
|
19
|
+
- [Enhancement] Remove the unused `DeliveryHandle` `:topic_name` struct field and its per-message allocation. Use `DeliveryHandle#topic` or `DeliveryReport#topic_name`, both unchanged.
|
|
20
|
+
- [Fix] Cache the partition count for a missing topic, so `produce` with a `partition_key` to a missing topic no longer re-runs a blocking metadata query on every message.
|
|
21
|
+
- [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.
|
|
22
|
+
- [Fix] Surface per-message build errors inline in `Consumer#poll_batch`/`#poll_batch_nb` instead of discarding the batch, preserving the messages that built successfully.
|
|
23
|
+
- [Fix] Bound the `Metadata` retry loop by a ~5s wall-clock budget with a floor of 3 attempts, cap the backoff at 1s, and stop overwriting the request timeout with the backoff value, which could block a synchronous fetch for minutes.
|
|
24
|
+
- [Fix] Synchronize `AbstractHandle::REGISTRY` mutations with a mutex, which could otherwise lose a write on JRuby and leave a handle unregistered or leaked.
|
|
25
|
+
- [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`.
|
|
26
|
+
- [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.
|
|
27
|
+
- [Fix] Stop leaking the native `rd_kafka_topic_conf_t` in `Producer#set_topic_config` when a per-topic config value is rejected.
|
|
28
|
+
- [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.
|
|
29
|
+
- [Fix] Guard the OAuthBearer token refresh callback against a NULL client pointer before calling `rd_kafka_name` on it.
|
|
30
|
+
- [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`.
|
|
31
|
+
- [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`.
|
|
32
|
+
- [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`.
|
|
33
|
+
- [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.
|
|
34
|
+
- [Fix] Stop `Metadata` from leaking the native metadata struct on every retried fetch; each attempt now frees its own native resources.
|
|
35
|
+
- [Fix] Stop `Producer#produce` from orphaning the delivery handle in the process-global registry when it fails after registering it.
|
|
36
|
+
- [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.
|
|
37
|
+
- [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.
|
|
38
|
+
- [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.
|
|
39
|
+
- [Fix] Raise instead of silently dropping a rejected `incremental_alter_configs` entry, which previously left the alter request reporting success.
|
|
40
|
+
- [Fix] Allocate the admin result-count out-parameter as `:size_t` instead of `:int32`, fixing a 4-byte overflow on every admin result parse.
|
|
41
|
+
- [Fix] Stabilize the flaky `Consumer#lag` "calculates the consumer lag" spec on overloaded CI.
|
|
42
|
+
- [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.
|
|
43
|
+
- [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.
|
|
44
|
+
|
|
3
45
|
## 0.28.0 (2026-06-03)
|
|
4
46
|
- [Enhancement] Bump librdkafka to `2.14.1`
|
|
5
47
|
- [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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rdkafka
|
|
2
2
|
|
|
3
|
-
[](https://github.com/karafka/rdkafka-ruby/actions/workflows/
|
|
3
|
+
[](https://github.com/karafka/rdkafka-ruby/actions/workflows/ci_linux_ubuntu_x86_64_gnu.yml)
|
|
4
4
|
[](https://badge.fury.io/rb/rdkafka)
|
|
5
5
|
[](https://slack.karafka.io)
|
|
6
6
|
|
|
@@ -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 |
|
|
@@ -173,7 +174,7 @@ bundle exec rake produce_messages
|
|
|
173
174
|
| 0.21.x (2025-02-13) | 2.8.0 (2025-01-07) | yes |
|
|
174
175
|
| 0.20.0 (2025-01-07) | 2.6.1 (2024-11-18) | yes |
|
|
175
176
|
| 0.19.0 (2024-10-01) | 2.5.3 (2024-09-02) | yes |
|
|
176
|
-
| 0.18.0 (2024-09-02) | 2.5.0 (2024-
|
|
177
|
+
| 0.18.0 (2024-09-02) | 2.5.0 (2024-07-10) | yes |
|
|
177
178
|
| 0.17.0 (2024-08-03) | 2.4.0 (2024-05-07) | no |
|
|
178
179
|
| 0.16.0 (2024-06-13) | 2.3.0 (2023-10-25) | no |
|
|
179
180
|
| 0.15.0 (2023-12-03) | 2.3.0 (2023-10-25) | no |
|
data/bin/verify_kafka_warnings
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
# Only specified warnings are allowed, all others should trigger failure
|
|
5
5
|
|
|
6
6
|
allowed_patterns=(
|
|
7
|
+
# Enabling share groups (KIP-932) requires "share" in group.coordinator.rebalance.protocols
|
|
8
|
+
# on cp-kafka 8.3.0 (Kafka 4.x). That mechanism is deprecated in favour of the share.version
|
|
9
|
+
# feature flag (Kafka 5.0), but is still functionally required to enable share groups in this
|
|
10
|
+
# version, so the broker logs this deprecation warning on every startup. Expected here.
|
|
11
|
+
"group.coordinator.rebalance.protocols. is deprecated"
|
|
7
12
|
"Performing controller activation"
|
|
8
13
|
"registered with feature metadata.version"
|
|
9
14
|
"Replayed TopicRecord for"
|
|
Binary file
|
data/docker-compose-ssl.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
services:
|
|
2
2
|
kafka:
|
|
3
3
|
container_name: kafka
|
|
4
|
-
image: confluentinc/cp-kafka:8.
|
|
4
|
+
image: confluentinc/cp-kafka:8.3.0
|
|
5
5
|
ports:
|
|
6
6
|
- 9092:9092 # Support PLAINTEXT so we can run one docker setup for SSL and PLAINTEXT
|
|
7
7
|
- 9093:9093
|
|
@@ -22,6 +22,9 @@ services:
|
|
|
22
22
|
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
|
|
23
23
|
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
|
24
24
|
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
|
25
|
+
KAFKA_GROUP_COORDINATOR_REBALANCE_PROTOCOLS: 'classic,consumer,share'
|
|
26
|
+
KAFKA_SHARE_COORDINATOR_STATE_TOPIC_REPLICATION_FACTOR: 1
|
|
27
|
+
KAFKA_SHARE_COORDINATOR_STATE_TOPIC_MIN_ISR: 1
|
|
25
28
|
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
|
|
26
29
|
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
|
|
27
30
|
|
data/docker-compose.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
services:
|
|
2
2
|
kafka:
|
|
3
3
|
container_name: kafka
|
|
4
|
-
image: confluentinc/cp-kafka:8.
|
|
4
|
+
image: confluentinc/cp-kafka:8.3.0
|
|
5
5
|
|
|
6
6
|
ports:
|
|
7
7
|
- 9092:9092
|
|
@@ -21,5 +21,8 @@ services:
|
|
|
21
21
|
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
|
|
22
22
|
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
|
23
23
|
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
|
24
|
+
KAFKA_GROUP_COORDINATOR_REBALANCE_PROTOCOLS: 'classic,consumer,share'
|
|
25
|
+
KAFKA_SHARE_COORDINATOR_STATE_TOPIC_REPLICATION_FACTOR: 1
|
|
26
|
+
KAFKA_SHARE_COORDINATOR_STATE_TOPIC_MIN_ISR: 1
|
|
24
27
|
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
|
|
25
28
|
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
|
|
@@ -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
|
|
@@ -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,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
|
|
@@ -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,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
|
|
@@ -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,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
|