rdkafka 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/FUNDING.yml +1 -0
- data/CHANGELOG.md +10 -2
- data/README.md +32 -22
- data/docker-compose.yml +2 -0
- data/ext/Rakefile +26 -53
- data/lib/rdkafka/admin/acl_binding_result.rb +37 -0
- data/lib/rdkafka/admin/create_acl_handle.rb +28 -0
- data/lib/rdkafka/admin/create_acl_report.rb +24 -0
- data/lib/rdkafka/admin/create_partitions_handle.rb +27 -0
- data/lib/rdkafka/admin/create_partitions_report.rb +6 -0
- data/lib/rdkafka/admin/delete_acl_handle.rb +30 -0
- data/lib/rdkafka/admin/delete_acl_report.rb +23 -0
- data/lib/rdkafka/admin/delete_groups_handle.rb +28 -0
- data/lib/rdkafka/admin/delete_groups_report.rb +24 -0
- data/lib/rdkafka/admin/describe_acl_handle.rb +30 -0
- data/lib/rdkafka/admin/describe_acl_report.rb +23 -0
- data/lib/rdkafka/admin.rb +443 -0
- data/lib/rdkafka/bindings.rb +119 -0
- data/lib/rdkafka/callbacks.rb +187 -0
- data/lib/rdkafka/config.rb +24 -3
- data/lib/rdkafka/consumer/headers.rb +1 -1
- data/lib/rdkafka/consumer/topic_partition_list.rb +8 -7
- data/lib/rdkafka/consumer.rb +46 -10
- data/lib/rdkafka/producer.rb +2 -2
- data/lib/rdkafka/version.rb +3 -3
- data/lib/rdkafka.rb +11 -0
- data/spec/rdkafka/admin/create_acl_handle_spec.rb +56 -0
- data/spec/rdkafka/admin/create_acl_report_spec.rb +18 -0
- data/spec/rdkafka/admin/delete_acl_handle_spec.rb +85 -0
- data/spec/rdkafka/admin/delete_acl_report_spec.rb +71 -0
- data/spec/rdkafka/admin/describe_acl_handle_spec.rb +85 -0
- data/spec/rdkafka/admin/describe_acl_report_spec.rb +72 -0
- data/spec/rdkafka/admin_spec.rb +204 -0
- data/spec/rdkafka/config_spec.rb +8 -0
- data/spec/rdkafka/consumer_spec.rb +69 -0
- data/spec/spec_helper.rb +3 -1
- data.tar.gz.sig +0 -0
- metadata +27 -4
- metadata.gz.sig +0 -0
- data/dist/librdkafka_2.2.0.tar.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d906b2e71dae5b5f45459e915c48dc8cb88e0d51ebb90ded80cef3c8e5531b77
|
4
|
+
data.tar.gz: 8f0df2688bbc3b264de22b5943b18462ad41898781cc12e6e534804409133ce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c35d392b326f4d47077f419bced92b929436be548651afc9364f5ada2eda51883ad75feeeb30183369aa6b15db3ac4630410f408eae449d1b0cc5a007cf011fc
|
7
|
+
data.tar.gz: 1487bb54713e6330ce55fd95f656dffd2edc34bcd8bc151d94faf2d6f043b8183276e3407d5f45c6152e99463c8323ccb83c15fff7007ebb96c4b369533002d5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
custom: ['https://karafka.io/#become-pro']
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# Rdkafka Changelog
|
2
2
|
|
3
|
-
## 0.
|
4
|
-
- [
|
3
|
+
## 0.15.0 (2023-12-03)
|
4
|
+
- **[Feature]** Add `Admin#metadata` (mensfeld)
|
5
|
+
- **[Feature]** Add `Admin#create_partitions` (mensfeld)
|
6
|
+
- **[Feature]** Add `Admin#delete_group` utility (piotaixr)
|
7
|
+
- **[Feature]** Add Create and Delete ACL Feature To Admin Functions (vgnanasekaran)
|
8
|
+
- **[Feature]** Support `#assignment_lost?` on a consumer to check for involuntary assignment revocation (mensfeld)
|
9
|
+
- [Enhancement] Expose alternative way of managing consumer events via a separate queue (mensfeld)
|
10
|
+
- [Enhancement] **Bump** librdkafka to 2.3.0 (mensfeld)
|
11
|
+
- [Enhancement] Increase the `#lag` and `#query_watermark_offsets` default timeouts from 100ms to 1000ms. This will compensate for network glitches and remote clusters operations (mensfeld)
|
12
|
+
- [Change] Use `SecureRandom.uuid` instead of `random` for test consumer groups (mensfeld)
|
5
13
|
|
6
14
|
## 0.14.0 (2023-11-21)
|
7
15
|
- [Enhancement] Add `raise_response_error` flag to the `Rdkafka::AbstractHandle`.
|
data/README.md
CHANGED
@@ -18,22 +18,31 @@ become EOL.
|
|
18
18
|
|
19
19
|
`rdkafka` was written because of the need for a reliable Ruby client for Kafka that supports modern Kafka at [AppSignal](https://appsignal.com). AppSignal runs it in production on very high-traffic systems.
|
20
20
|
|
21
|
-
The most important pieces of a Kafka client are implemented.
|
22
|
-
working towards feature completeness. You can track that here:
|
23
|
-
https://github.com/appsignal/rdkafka-ruby/milestone/1
|
21
|
+
The most important pieces of a Kafka client are implemented, and we aim to provide all relevant consumer, producer, and admin APIs.
|
24
22
|
|
25
23
|
## Table of content
|
26
24
|
|
25
|
+
- [Project Scope](#project-scope)
|
27
26
|
- [Installation](#installation)
|
28
27
|
- [Usage](#usage)
|
29
|
-
* [Consuming
|
30
|
-
* [Producing
|
31
|
-
- [Higher
|
32
|
-
* [Message
|
33
|
-
* [Message
|
28
|
+
* [Consuming Messages](#consuming-messages)
|
29
|
+
* [Producing Messages](#producing-messages)
|
30
|
+
- [Higher Level Libraries](#higher-level-libraries)
|
31
|
+
* [Message Processing Frameworks](#message-processing-frameworks)
|
32
|
+
* [Message Publishing Libraries](#message-publishing-libraries)
|
34
33
|
- [Development](#development)
|
35
34
|
- [Example](#example)
|
36
35
|
|
36
|
+
## Project Scope
|
37
|
+
|
38
|
+
While rdkafka-ruby aims to simplify the use of librdkafka in Ruby applications, it's important to understand the limitations of this library:
|
39
|
+
|
40
|
+
- **No Complex Producers/Consumers**: This library does not intend to offer complex producers or consumers. The aim is to stick closely to the functionalities provided by librdkafka itself.
|
41
|
+
|
42
|
+
- **Focus on librdkafka Capabilities**: Features that can be achieved directly in Ruby, without specific needs from librdkafka, are outside the scope of this library.
|
43
|
+
|
44
|
+
- **Existing High-Level Functionalities**: Certain high-level functionalities like producer metadata cache and simple consumer are already part of the library. Although they fall slightly outside the primary goal, they will remain part of the contract, given their existing usage.
|
45
|
+
|
37
46
|
|
38
47
|
## Installation
|
39
48
|
|
@@ -42,9 +51,9 @@ If you have any problems installing the gem, please open an issue.
|
|
42
51
|
|
43
52
|
## Usage
|
44
53
|
|
45
|
-
See the [documentation](https://
|
54
|
+
See the [documentation](https://karafka.io/docs/code/rdkafka-ruby/) for full details on how to use this gem. Two quick examples:
|
46
55
|
|
47
|
-
### Consuming
|
56
|
+
### Consuming Messages
|
48
57
|
|
49
58
|
Subscribe to a topic and get messages. Kafka will automatically spread
|
50
59
|
the available partitions over consumers with the same group id.
|
@@ -62,7 +71,7 @@ consumer.each do |message|
|
|
62
71
|
end
|
63
72
|
```
|
64
73
|
|
65
|
-
### Producing
|
74
|
+
### Producing Messages
|
66
75
|
|
67
76
|
Produce a number of messages, put the delivery handles in an array, and
|
68
77
|
wait for them before exiting. This way the messages will be batched and
|
@@ -89,41 +98,42 @@ Note that creating a producer consumes some resources that will not be
|
|
89
98
|
released until it `#close` is explicitly called, so be sure to call
|
90
99
|
`Config#producer` only as necessary.
|
91
100
|
|
92
|
-
## Higher
|
101
|
+
## Higher Level Libraries
|
93
102
|
|
94
103
|
Currently, there are two actively developed frameworks based on rdkafka-ruby, that provide higher-level API that can be used to work with Kafka messages and one library for publishing messages.
|
95
104
|
|
96
|
-
### Message
|
105
|
+
### Message Processing Frameworks
|
97
106
|
|
98
107
|
* [Karafka](https://github.com/karafka/karafka) - Ruby and Rails efficient Kafka processing framework.
|
99
108
|
* [Racecar](https://github.com/zendesk/racecar) - A simple framework for Kafka consumers in Ruby
|
100
109
|
|
101
|
-
### Message
|
110
|
+
### Message Publishing Libraries
|
102
111
|
|
103
112
|
* [WaterDrop](https://github.com/karafka/waterdrop) – Standalone Karafka library for producing Kafka messages.
|
104
113
|
|
105
114
|
## Development
|
106
115
|
|
107
|
-
|
108
|
-
|
116
|
+
Contributors are encouraged to focus on enhancements that align with the core goal of the library. We appreciate contributions but will likely not accept pull requests for features that:
|
117
|
+
|
118
|
+
- Implement functionalities that can achieved using standard Ruby capabilities without changes to the underlying rdkafka-ruby bindings.
|
119
|
+
- Deviate significantly from the primary aim of providing librdkafka bindings with Ruby-friendly interfaces.
|
120
|
+
|
121
|
+
A Docker Compose file is included to run Kafka. To run that:
|
109
122
|
|
110
123
|
```
|
111
124
|
docker-compose up
|
112
125
|
```
|
113
126
|
|
114
|
-
Run `bundle` and `cd ext && bundle exec rake && cd ..` to download and
|
115
|
-
compile `librdkafka`.
|
127
|
+
Run `bundle` and `cd ext && bundle exec rake && cd ..` to download and compile `librdkafka`.
|
116
128
|
|
117
|
-
You can then run `bundle exec rspec` to run the tests. To see rdkafka
|
118
|
-
debug output:
|
129
|
+
You can then run `bundle exec rspec` to run the tests. To see rdkafka debug output:
|
119
130
|
|
120
131
|
```
|
121
132
|
DEBUG_PRODUCER=true bundle exec rspec
|
122
133
|
DEBUG_CONSUMER=true bundle exec rspec
|
123
134
|
```
|
124
135
|
|
125
|
-
After running the tests, you can bring the cluster down to start with a
|
126
|
-
clean slate:
|
136
|
+
After running the tests, you can bring the cluster down to start with a clean slate:
|
127
137
|
|
128
138
|
```
|
129
139
|
docker-compose down
|
data/docker-compose.yml
CHANGED
@@ -23,3 +23,5 @@ services:
|
|
23
23
|
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
|
24
24
|
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
25
25
|
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
26
|
+
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
|
27
|
+
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
|
data/ext/Rakefile
CHANGED
@@ -1,67 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require File.expand_path('../../lib/rdkafka/version', __FILE__)
|
4
|
+
require "mini_portile2"
|
4
5
|
require "fileutils"
|
5
6
|
require "open-uri"
|
6
7
|
|
7
8
|
task :default => :clean do
|
8
|
-
#
|
9
|
-
|
10
|
-
#
|
11
|
-
# Mini_portile causes an issue because it's dependencies are downloaded on the fly and therefore don't exist/aren't
|
12
|
-
# accessible in the nix environment
|
13
|
-
if ENV.fetch('RDKAFKA_EXT_PATH', '').empty?
|
14
|
-
# Download and compile librdkafka if RDKAFKA_EXT_PATH is not set
|
15
|
-
require "mini_portile2"
|
16
|
-
recipe = MiniPortile.new("librdkafka", Rdkafka::LIBRDKAFKA_VERSION)
|
9
|
+
# Download and compile librdkafka
|
10
|
+
recipe = MiniPortile.new("librdkafka", Rdkafka::LIBRDKAFKA_VERSION)
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
releases = File.expand_path(File.join(File.dirname(__FILE__), '../dist'))
|
26
|
-
|
27
|
-
recipe.files << {
|
28
|
-
:url => "file://#{releases}/librdkafka_#{Rdkafka::LIBRDKAFKA_VERSION}.tar.gz",
|
29
|
-
:sha256 => Rdkafka::LIBRDKAFKA_SOURCE_SHA256
|
30
|
-
}
|
31
|
-
recipe.configure_options = ["--host=#{recipe.host}"]
|
32
|
-
|
33
|
-
# Disable using libc regex engine in favor of the embedded one
|
34
|
-
# The default regex engine of librdkafka does not always work exactly as most of the users
|
35
|
-
# would expect, hence this flag allows for changing it to the other one
|
36
|
-
if ENV.key?('RDKAFKA_DISABLE_REGEX_EXT')
|
37
|
-
recipe.configure_options << '--disable-regex-ext'
|
38
|
-
end
|
12
|
+
# Use default homebrew openssl if we're on mac and the directory exists
|
13
|
+
# and each of flags is not empty
|
14
|
+
if recipe.host&.include?("darwin") && system("which brew &> /dev/null") && Dir.exist?("#{homebrew_prefix = %x(brew --prefix openssl).strip}")
|
15
|
+
ENV["CPPFLAGS"] = "-I#{homebrew_prefix}/include" unless ENV["CPPFLAGS"]
|
16
|
+
ENV["LDFLAGS"] = "-L#{homebrew_prefix}/lib" unless ENV["LDFLAGS"]
|
17
|
+
end
|
39
18
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
FileUtils.mv(lib_path, File.join(File.dirname(__FILE__), "librdkafka.#{to_extension}"))
|
51
|
-
# Cleanup files created by miniportile we don't need in the gem
|
52
|
-
FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp")
|
53
|
-
FileUtils.rm_rf File.join(File.dirname(__FILE__), "ports")
|
19
|
+
recipe.files << {
|
20
|
+
:url => "https://codeload.github.com/confluentinc/librdkafka/tar.gz/v#{Rdkafka::LIBRDKAFKA_VERSION}",
|
21
|
+
:sha256 => Rdkafka::LIBRDKAFKA_SOURCE_SHA256
|
22
|
+
}
|
23
|
+
recipe.configure_options = ["--host=#{recipe.host}"]
|
24
|
+
recipe.cook
|
25
|
+
# Move dynamic library we're interested in
|
26
|
+
if recipe.host.include?('darwin')
|
27
|
+
from_extension = '1.dylib'
|
28
|
+
to_extension = 'dylib'
|
54
29
|
else
|
55
|
-
|
56
|
-
|
57
|
-
raise "RDKAFKA_EXT_PATH must be set in your nix config when running under nix"
|
58
|
-
end
|
59
|
-
files = [
|
60
|
-
File.join(ENV['RDKAFKA_EXT_PATH'], 'lib', 'librdkafka.dylib'),
|
61
|
-
File.join(ENV['RDKAFKA_EXT_PATH'], 'lib', 'librdkafka.so')
|
62
|
-
]
|
63
|
-
files.each { |ext| FileUtils.cp(ext, File.dirname(__FILE__)) if File.exist?(ext) }
|
30
|
+
from_extension = 'so.1'
|
31
|
+
to_extension = 'so'
|
64
32
|
end
|
33
|
+
lib_path = File.join(File.dirname(__FILE__), "ports/#{recipe.host}/librdkafka/#{Rdkafka::LIBRDKAFKA_VERSION}/lib/librdkafka.#{from_extension}")
|
34
|
+
FileUtils.mv(lib_path, File.join(File.dirname(__FILE__), "librdkafka.#{to_extension}"))
|
35
|
+
# Cleanup files created by miniportile we don't need in the gem
|
36
|
+
FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp")
|
37
|
+
FileUtils.rm_rf File.join(File.dirname(__FILE__), "ports")
|
65
38
|
end
|
66
39
|
|
67
40
|
task :clean do
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
|
6
|
+
# Extracts attributes of rd_kafka_AclBinding_t
|
7
|
+
#
|
8
|
+
class AclBindingResult
|
9
|
+
attr_reader :result_error, :error_string, :matching_acl_resource_type, :matching_acl_resource_name, :matching_acl_pattern_type, :matching_acl_principal, :matching_acl_host, :matching_acl_operation, :matching_acl_permission_type
|
10
|
+
|
11
|
+
def initialize(matching_acl)
|
12
|
+
rd_kafka_error_pointer = Rdkafka::Bindings.rd_kafka_AclBinding_error(matching_acl)
|
13
|
+
@result_error = Rdkafka::Bindings.rd_kafka_error_code(rd_kafka_error_pointer)
|
14
|
+
error_string = Rdkafka::Bindings.rd_kafka_error_string(rd_kafka_error_pointer)
|
15
|
+
if error_string != FFI::Pointer::NULL
|
16
|
+
@error_string = error_string.read_string
|
17
|
+
end
|
18
|
+
@matching_acl_resource_type = Rdkafka::Bindings.rd_kafka_AclBinding_restype(matching_acl)
|
19
|
+
matching_acl_resource_name = Rdkafka::Bindings.rd_kafka_AclBinding_name(matching_acl)
|
20
|
+
if matching_acl_resource_name != FFI::Pointer::NULL
|
21
|
+
@matching_acl_resource_name = matching_acl_resource_name.read_string
|
22
|
+
end
|
23
|
+
@matching_acl_pattern_type = Rdkafka::Bindings.rd_kafka_AclBinding_resource_pattern_type(matching_acl)
|
24
|
+
matching_acl_principal = Rdkafka::Bindings.rd_kafka_AclBinding_principal(matching_acl)
|
25
|
+
if matching_acl_principal != FFI::Pointer::NULL
|
26
|
+
@matching_acl_principal = matching_acl_principal.read_string
|
27
|
+
end
|
28
|
+
matching_acl_host = Rdkafka::Bindings.rd_kafka_AclBinding_host(matching_acl)
|
29
|
+
if matching_acl_host != FFI::Pointer::NULL
|
30
|
+
@matching_acl_host = matching_acl_host.read_string
|
31
|
+
end
|
32
|
+
@matching_acl_operation = Rdkafka::Bindings.rd_kafka_AclBinding_operation(matching_acl)
|
33
|
+
@matching_acl_permission_type = Rdkafka::Bindings.rd_kafka_AclBinding_permission_type(matching_acl)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class CreateAclHandle < AbstractHandle
|
6
|
+
layout :pending, :bool,
|
7
|
+
:response, :int,
|
8
|
+
:response_string, :pointer
|
9
|
+
|
10
|
+
# @return [String] the name of the operation
|
11
|
+
def operation_name
|
12
|
+
"create acl"
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [CreateAclReport] instance with rdkafka_response value as 0 and rdkafka_response_string value as empty string if the acl creation was successful
|
16
|
+
def create_result
|
17
|
+
CreateAclReport.new(rdkafka_response: self[:response], rdkafka_response_string: self[:response_string])
|
18
|
+
end
|
19
|
+
|
20
|
+
def raise_error
|
21
|
+
raise RdkafkaError.new(
|
22
|
+
self[:response],
|
23
|
+
broker_message: self[:response_string].read_string
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class CreateAclReport
|
6
|
+
|
7
|
+
# Upon successful creation of Acl RD_KAFKA_RESP_ERR_NO_ERROR - 0 is returned as rdkafka_response
|
8
|
+
# @return [Integer]
|
9
|
+
attr_reader :rdkafka_response
|
10
|
+
|
11
|
+
|
12
|
+
# Upon successful creation of Acl empty string will be returned as rdkafka_response_string
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :rdkafka_response_string
|
15
|
+
|
16
|
+
def initialize(rdkafka_response:, rdkafka_response_string:)
|
17
|
+
@rdkafka_response = rdkafka_response
|
18
|
+
if rdkafka_response_string != FFI::Pointer::NULL
|
19
|
+
@rdkafka_response_string = rdkafka_response_string.read_string
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Rdkafka
|
2
|
+
class Admin
|
3
|
+
class CreatePartitionsHandle < AbstractHandle
|
4
|
+
layout :pending, :bool,
|
5
|
+
:response, :int,
|
6
|
+
:error_string, :pointer,
|
7
|
+
:result_name, :pointer
|
8
|
+
|
9
|
+
# @return [String] the name of the operation
|
10
|
+
def operation_name
|
11
|
+
"create partitions"
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Boolean] whether the create topic was successful
|
15
|
+
def create_result
|
16
|
+
CreatePartitionsReport.new(self[:error_string], self[:result_name])
|
17
|
+
end
|
18
|
+
|
19
|
+
def raise_error
|
20
|
+
raise RdkafkaError.new(
|
21
|
+
self[:response],
|
22
|
+
broker_message: CreateTopicReport.new(self[:error_string], self[:result_name]).error_string
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class DeleteAclHandle < AbstractHandle
|
6
|
+
layout :pending, :bool,
|
7
|
+
:response, :int,
|
8
|
+
:response_string, :pointer,
|
9
|
+
:matching_acls, :pointer,
|
10
|
+
:matching_acls_count, :int
|
11
|
+
|
12
|
+
# @return [String] the name of the operation
|
13
|
+
def operation_name
|
14
|
+
"delete acl"
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [DeleteAclReport] instance with an array of matching_acls
|
18
|
+
def create_result
|
19
|
+
DeleteAclReport.new(matching_acls: self[:matching_acls], matching_acls_count: self[:matching_acls_count])
|
20
|
+
end
|
21
|
+
|
22
|
+
def raise_error
|
23
|
+
raise RdkafkaError.new(
|
24
|
+
self[:response],
|
25
|
+
broker_message: self[:response_string].read_string
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class DeleteAclReport
|
6
|
+
|
7
|
+
# deleted acls
|
8
|
+
# @return [Rdkafka::Bindings::AclBindingResult]
|
9
|
+
attr_reader :deleted_acls
|
10
|
+
|
11
|
+
def initialize(matching_acls:, matching_acls_count:)
|
12
|
+
@deleted_acls=[]
|
13
|
+
if matching_acls != FFI::Pointer::NULL
|
14
|
+
acl_binding_result_pointers = matching_acls.read_array_of_pointer(matching_acls_count)
|
15
|
+
(1..matching_acls_count).map do |matching_acl_index|
|
16
|
+
acl_binding_result = AclBindingResult.new(acl_binding_result_pointers[matching_acl_index - 1])
|
17
|
+
@deleted_acls << acl_binding_result
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class DeleteGroupsHandle < AbstractHandle
|
6
|
+
layout :pending, :bool, # TODO: ???
|
7
|
+
:response, :int,
|
8
|
+
:error_string, :pointer,
|
9
|
+
:result_name, :pointer
|
10
|
+
|
11
|
+
# @return [String] the name of the operation
|
12
|
+
def operation_name
|
13
|
+
"delete groups"
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_result
|
17
|
+
DeleteGroupsReport.new(self[:error_string], self[:result_name])
|
18
|
+
end
|
19
|
+
|
20
|
+
def raise_error
|
21
|
+
raise RdkafkaError.new(
|
22
|
+
self[:response],
|
23
|
+
broker_message: create_result.error_string
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class DeleteGroupsReport
|
6
|
+
# Any error message generated from the DeleteTopic
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :error_string
|
9
|
+
|
10
|
+
# The name of the topic deleted
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :result_name
|
13
|
+
|
14
|
+
def initialize(error_string, result_name)
|
15
|
+
if error_string != FFI::Pointer::NULL
|
16
|
+
@error_string = error_string.read_string
|
17
|
+
end
|
18
|
+
if result_name != FFI::Pointer::NULL
|
19
|
+
@result_name = @result_name = result_name.read_string
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class DescribeAclHandle < AbstractHandle
|
6
|
+
layout :pending, :bool,
|
7
|
+
:response, :int,
|
8
|
+
:response_string, :pointer,
|
9
|
+
:acls, :pointer,
|
10
|
+
:acls_count, :int
|
11
|
+
|
12
|
+
# @return [String] the name of the operation.
|
13
|
+
def operation_name
|
14
|
+
"describe acl"
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [DescribeAclReport] instance with an array of acls that matches the request filters.
|
18
|
+
def create_result
|
19
|
+
DescribeAclReport.new(acls: self[:acls], acls_count: self[:acls_count])
|
20
|
+
end
|
21
|
+
|
22
|
+
def raise_error
|
23
|
+
raise RdkafkaError.new(
|
24
|
+
self[:response],
|
25
|
+
broker_message: self[:response_string].read_string
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rdkafka
|
4
|
+
class Admin
|
5
|
+
class DescribeAclReport
|
6
|
+
|
7
|
+
# acls that exists in the cluster for the resource_type, resource_name and pattern_type filters provided in the request.
|
8
|
+
# @return [Rdkafka::Bindings::AclBindingResult] array of matching acls.
|
9
|
+
attr_reader :acls
|
10
|
+
|
11
|
+
def initialize(acls:, acls_count:)
|
12
|
+
@acls=[]
|
13
|
+
if acls != FFI::Pointer::NULL
|
14
|
+
acl_binding_result_pointers = acls.read_array_of_pointer(acls_count)
|
15
|
+
(1..acls_count).map do |acl_index|
|
16
|
+
acl_binding_result = AclBindingResult.new(acl_binding_result_pointers[acl_index - 1])
|
17
|
+
@acls << acl_binding_result
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|