rdkafka 0.22.2 → 0.27.0
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 +63 -3
- data/Gemfile +8 -0
- data/Gemfile.lint +14 -0
- data/Gemfile.lint.lock +123 -0
- data/README.md +19 -14
- data/Rakefile +21 -21
- data/bin/verify_kafka_warnings +39 -0
- data/dist/{librdkafka-2.8.0.tar.gz → librdkafka-2.14.0.tar.gz} +0 -0
- data/docker-compose-ssl.yml +35 -0
- data/docker-compose.yml +2 -2
- data/ext/Rakefile +27 -27
- data/lib/rdkafka/abstract_handle.rb +23 -5
- data/lib/rdkafka/admin/acl_binding_result.rb +5 -5
- data/lib/rdkafka/admin/config_resource_binding_result.rb +1 -0
- data/lib/rdkafka/admin/create_acl_handle.rb +7 -4
- data/lib/rdkafka/admin/create_acl_report.rb +3 -2
- data/lib/rdkafka/admin/create_partitions_handle.rb +8 -5
- data/lib/rdkafka/admin/create_partitions_report.rb +1 -0
- data/lib/rdkafka/admin/create_topic_handle.rb +8 -5
- data/lib/rdkafka/admin/create_topic_report.rb +3 -0
- data/lib/rdkafka/admin/delete_acl_handle.rb +9 -6
- data/lib/rdkafka/admin/delete_acl_report.rb +5 -3
- data/lib/rdkafka/admin/delete_groups_handle.rb +10 -5
- data/lib/rdkafka/admin/delete_groups_report.rb +3 -0
- data/lib/rdkafka/admin/delete_topic_handle.rb +8 -5
- data/lib/rdkafka/admin/delete_topic_report.rb +3 -0
- data/lib/rdkafka/admin/describe_acl_handle.rb +9 -6
- data/lib/rdkafka/admin/describe_acl_report.rb +5 -3
- data/lib/rdkafka/admin/describe_configs_handle.rb +7 -4
- data/lib/rdkafka/admin/describe_configs_report.rb +7 -1
- data/lib/rdkafka/admin/incremental_alter_configs_handle.rb +7 -4
- data/lib/rdkafka/admin/incremental_alter_configs_report.rb +7 -1
- data/lib/rdkafka/admin/list_offsets_handle.rb +36 -0
- data/lib/rdkafka/admin/list_offsets_report.rb +51 -0
- data/lib/rdkafka/admin.rb +301 -135
- data/lib/rdkafka/bindings.rb +199 -110
- data/lib/rdkafka/callbacks.rb +124 -21
- data/lib/rdkafka/config.rb +81 -33
- data/lib/rdkafka/consumer/headers.rb +3 -2
- data/lib/rdkafka/consumer/message.rb +12 -11
- data/lib/rdkafka/consumer/partition.rb +8 -4
- data/lib/rdkafka/consumer/topic_partition_list.rb +21 -17
- data/lib/rdkafka/consumer.rb +397 -45
- data/lib/rdkafka/defaults.rb +106 -0
- data/lib/rdkafka/error.rb +40 -14
- data/lib/rdkafka/helpers/oauth.rb +45 -13
- data/lib/rdkafka/helpers/time.rb +5 -0
- data/lib/rdkafka/metadata.rb +45 -21
- data/lib/rdkafka/native_kafka.rb +89 -4
- data/lib/rdkafka/producer/delivery_handle.rb +5 -5
- data/lib/rdkafka/producer/delivery_report.rb +10 -6
- data/lib/rdkafka/producer/partitions_count_cache.rb +29 -19
- data/lib/rdkafka/producer.rb +168 -82
- data/lib/rdkafka/version.rb +6 -3
- data/lib/rdkafka.rb +3 -0
- data/package-lock.json +331 -0
- data/package.json +9 -0
- data/rdkafka.gemspec +57 -36
- data/renovate.json +29 -24
- metadata +29 -124
- data/.github/CODEOWNERS +0 -3
- data/.github/FUNDING.yml +0 -1
- data/.github/workflows/ci_linux_x86_64_gnu.yml +0 -271
- data/.github/workflows/ci_linux_x86_64_musl.yml +0 -194
- data/.github/workflows/ci_macos_arm64.yml +0 -284
- data/.github/workflows/push_linux_x86_64_gnu.yml +0 -65
- data/.github/workflows/push_linux_x86_64_musl.yml +0 -79
- data/.github/workflows/push_macos_arm64.yml +0 -54
- data/.github/workflows/push_ruby.yml +0 -37
- data/.github/workflows/verify-action-pins.yml +0 -16
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.yardopts +0 -2
- data/ext/README.md +0 -19
- data/ext/build_common.sh +0 -361
- data/ext/build_linux_x86_64_gnu.sh +0 -306
- data/ext/build_linux_x86_64_musl.sh +0 -763
- data/ext/build_macos_arm64.sh +0 -550
- data/spec/rdkafka/abstract_handle_spec.rb +0 -117
- data/spec/rdkafka/admin/create_acl_handle_spec.rb +0 -56
- data/spec/rdkafka/admin/create_acl_report_spec.rb +0 -18
- data/spec/rdkafka/admin/create_topic_handle_spec.rb +0 -52
- data/spec/rdkafka/admin/create_topic_report_spec.rb +0 -16
- data/spec/rdkafka/admin/delete_acl_handle_spec.rb +0 -85
- data/spec/rdkafka/admin/delete_acl_report_spec.rb +0 -72
- data/spec/rdkafka/admin/delete_topic_handle_spec.rb +0 -52
- data/spec/rdkafka/admin/delete_topic_report_spec.rb +0 -16
- data/spec/rdkafka/admin/describe_acl_handle_spec.rb +0 -85
- data/spec/rdkafka/admin/describe_acl_report_spec.rb +0 -73
- data/spec/rdkafka/admin_spec.rb +0 -971
- data/spec/rdkafka/bindings_spec.rb +0 -199
- data/spec/rdkafka/callbacks_spec.rb +0 -20
- data/spec/rdkafka/config_spec.rb +0 -258
- data/spec/rdkafka/consumer/headers_spec.rb +0 -73
- data/spec/rdkafka/consumer/message_spec.rb +0 -139
- data/spec/rdkafka/consumer/partition_spec.rb +0 -57
- data/spec/rdkafka/consumer/topic_partition_list_spec.rb +0 -248
- data/spec/rdkafka/consumer_spec.rb +0 -1274
- data/spec/rdkafka/error_spec.rb +0 -89
- data/spec/rdkafka/metadata_spec.rb +0 -79
- data/spec/rdkafka/native_kafka_spec.rb +0 -130
- data/spec/rdkafka/producer/delivery_handle_spec.rb +0 -45
- data/spec/rdkafka/producer/delivery_report_spec.rb +0 -25
- data/spec/rdkafka/producer/partitions_count_cache_spec.rb +0 -359
- data/spec/rdkafka/producer_spec.rb +0 -1345
- data/spec/spec_helper.rb +0 -195
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe Rdkafka::Consumer::Partition do
|
|
4
|
-
let(:offset) { 100 }
|
|
5
|
-
let(:err) { 0 }
|
|
6
|
-
subject { Rdkafka::Consumer::Partition.new(1, offset, err) }
|
|
7
|
-
|
|
8
|
-
it "should have a partition" do
|
|
9
|
-
expect(subject.partition).to eq 1
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should have an offset" do
|
|
13
|
-
expect(subject.offset).to eq 100
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "should have an err code" do
|
|
17
|
-
expect(subject.err).to eq 0
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe "#to_s" do
|
|
21
|
-
it "should return a human readable representation" do
|
|
22
|
-
expect(subject.to_s).to eq "<Partition 1 offset=100>"
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe "#inspect" do
|
|
27
|
-
it "should return a human readable representation" do
|
|
28
|
-
expect(subject.to_s).to eq "<Partition 1 offset=100>"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "without offset" do
|
|
32
|
-
let(:offset) { nil }
|
|
33
|
-
|
|
34
|
-
it "should return a human readable representation" do
|
|
35
|
-
expect(subject.to_s).to eq "<Partition 1>"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
context "with err code" do
|
|
40
|
-
let(:err) { 1 }
|
|
41
|
-
|
|
42
|
-
it "should return a human readable representation" do
|
|
43
|
-
expect(subject.to_s).to eq "<Partition 1 offset=100 err=1>"
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe "#==" do
|
|
49
|
-
it "should equal another partition with the same content" do
|
|
50
|
-
expect(subject).to eq Rdkafka::Consumer::Partition.new(1, 100)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "should not equal another partition with different content" do
|
|
54
|
-
expect(subject).not_to eq Rdkafka::Consumer::Partition.new(2, 101)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
describe Rdkafka::Consumer::TopicPartitionList do
|
|
4
|
-
it "should create a new list and add unassigned topics" do
|
|
5
|
-
list = Rdkafka::Consumer::TopicPartitionList.new
|
|
6
|
-
|
|
7
|
-
expect(list.count).to eq 0
|
|
8
|
-
expect(list.empty?).to be true
|
|
9
|
-
|
|
10
|
-
list.add_topic("topic1")
|
|
11
|
-
list.add_topic("topic2")
|
|
12
|
-
|
|
13
|
-
expect(list.count).to eq 2
|
|
14
|
-
expect(list.empty?).to be false
|
|
15
|
-
|
|
16
|
-
hash = list.to_h
|
|
17
|
-
expect(hash.count).to eq 2
|
|
18
|
-
expect(hash).to eq ({
|
|
19
|
-
"topic1" => nil,
|
|
20
|
-
"topic2" => nil
|
|
21
|
-
})
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "should create a new list and add assigned topics as a range" do
|
|
25
|
-
list = Rdkafka::Consumer::TopicPartitionList.new
|
|
26
|
-
|
|
27
|
-
expect(list.count).to eq 0
|
|
28
|
-
expect(list.empty?).to be true
|
|
29
|
-
|
|
30
|
-
list.add_topic("topic1", (0..2))
|
|
31
|
-
list.add_topic("topic2", (0..1))
|
|
32
|
-
|
|
33
|
-
expect(list.count).to eq 5
|
|
34
|
-
expect(list.empty?).to be false
|
|
35
|
-
|
|
36
|
-
hash = list.to_h
|
|
37
|
-
expect(hash.count).to eq 2
|
|
38
|
-
expect(hash["topic1"]).to eq([
|
|
39
|
-
Rdkafka::Consumer::Partition.new(0, nil),
|
|
40
|
-
Rdkafka::Consumer::Partition.new(1, nil),
|
|
41
|
-
Rdkafka::Consumer::Partition.new(2, nil)
|
|
42
|
-
])
|
|
43
|
-
expect(hash["topic2"]).to eq([
|
|
44
|
-
Rdkafka::Consumer::Partition.new(0, nil),
|
|
45
|
-
Rdkafka::Consumer::Partition.new(1, nil)
|
|
46
|
-
])
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "should create a new list and add assigned topics as an array" do
|
|
50
|
-
list = Rdkafka::Consumer::TopicPartitionList.new
|
|
51
|
-
|
|
52
|
-
expect(list.count).to eq 0
|
|
53
|
-
expect(list.empty?).to be true
|
|
54
|
-
|
|
55
|
-
list.add_topic("topic1", [0, 1, 2])
|
|
56
|
-
list.add_topic("topic2", [0, 1])
|
|
57
|
-
|
|
58
|
-
expect(list.count).to eq 5
|
|
59
|
-
expect(list.empty?).to be false
|
|
60
|
-
|
|
61
|
-
hash = list.to_h
|
|
62
|
-
expect(hash.count).to eq 2
|
|
63
|
-
expect(hash["topic1"]).to eq([
|
|
64
|
-
Rdkafka::Consumer::Partition.new(0, nil),
|
|
65
|
-
Rdkafka::Consumer::Partition.new(1, nil),
|
|
66
|
-
Rdkafka::Consumer::Partition.new(2, nil)
|
|
67
|
-
])
|
|
68
|
-
expect(hash["topic2"]).to eq([
|
|
69
|
-
Rdkafka::Consumer::Partition.new(0, nil),
|
|
70
|
-
Rdkafka::Consumer::Partition.new(1, nil)
|
|
71
|
-
])
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it "should create a new list and add assigned topics as a count" do
|
|
75
|
-
list = Rdkafka::Consumer::TopicPartitionList.new
|
|
76
|
-
|
|
77
|
-
expect(list.count).to eq 0
|
|
78
|
-
expect(list.empty?).to be true
|
|
79
|
-
|
|
80
|
-
list.add_topic("topic1", 3)
|
|
81
|
-
list.add_topic("topic2", 2)
|
|
82
|
-
|
|
83
|
-
expect(list.count).to eq 5
|
|
84
|
-
expect(list.empty?).to be false
|
|
85
|
-
|
|
86
|
-
hash = list.to_h
|
|
87
|
-
expect(hash.count).to eq 2
|
|
88
|
-
expect(hash["topic1"]).to eq([
|
|
89
|
-
Rdkafka::Consumer::Partition.new(0, nil),
|
|
90
|
-
Rdkafka::Consumer::Partition.new(1, nil),
|
|
91
|
-
Rdkafka::Consumer::Partition.new(2, nil)
|
|
92
|
-
])
|
|
93
|
-
expect(hash["topic2"]).to eq([
|
|
94
|
-
Rdkafka::Consumer::Partition.new(0, nil),
|
|
95
|
-
Rdkafka::Consumer::Partition.new(1, nil)
|
|
96
|
-
])
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it "should create a new list and add topics and partitions with an offset" do
|
|
100
|
-
list = Rdkafka::Consumer::TopicPartitionList.new
|
|
101
|
-
|
|
102
|
-
expect(list.count).to eq 0
|
|
103
|
-
expect(list.empty?).to be true
|
|
104
|
-
|
|
105
|
-
list.add_topic_and_partitions_with_offsets("topic1", 0 => 5, 1 => 6, 2 => 7)
|
|
106
|
-
|
|
107
|
-
hash = list.to_h
|
|
108
|
-
expect(hash.count).to eq 1
|
|
109
|
-
expect(hash["topic1"]).to eq([
|
|
110
|
-
Rdkafka::Consumer::Partition.new(0, 5),
|
|
111
|
-
Rdkafka::Consumer::Partition.new(1, 6),
|
|
112
|
-
Rdkafka::Consumer::Partition.new(2, 7)
|
|
113
|
-
])
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
describe "#to_s" do
|
|
117
|
-
let(:expected) do
|
|
118
|
-
if RUBY_VERSION >= '3.4.0'
|
|
119
|
-
"<TopicPartitionList: {\"topic1\" => [<Partition 0>, <Partition 1>]}>"
|
|
120
|
-
else
|
|
121
|
-
"<TopicPartitionList: {\"topic1\"=>[<Partition 0>, <Partition 1>]}>"
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "should return a human readable representation" do
|
|
126
|
-
list = Rdkafka::Consumer::TopicPartitionList.new
|
|
127
|
-
list.add_topic("topic1", [0, 1])
|
|
128
|
-
|
|
129
|
-
expect(list.to_s).to eq expected
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
describe "#==" do
|
|
134
|
-
subject do
|
|
135
|
-
Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
136
|
-
list.add_topic("topic1", [0])
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
it "should equal another partition with the same content" do
|
|
141
|
-
other = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
142
|
-
list.add_topic("topic1", [0])
|
|
143
|
-
end
|
|
144
|
-
expect(subject).to eq other
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
it "should not equal another partition with different content" do
|
|
148
|
-
expect(subject).not_to eq Rdkafka::Consumer::TopicPartitionList.new
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
describe ".from_native_tpl" do
|
|
153
|
-
it "should create a list from an existing native list" do
|
|
154
|
-
pointer = Rdkafka::Bindings.rd_kafka_topic_partition_list_new(5)
|
|
155
|
-
Rdkafka::Bindings.rd_kafka_topic_partition_list_add(
|
|
156
|
-
pointer,
|
|
157
|
-
"topic",
|
|
158
|
-
-1
|
|
159
|
-
)
|
|
160
|
-
list = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(pointer)
|
|
161
|
-
|
|
162
|
-
other = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
163
|
-
list.add_topic("topic")
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
expect(list).to eq other
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
it "should create a list from an existing native list with offsets" do
|
|
170
|
-
pointer = Rdkafka::Bindings.rd_kafka_topic_partition_list_new(5)
|
|
171
|
-
Rdkafka::Bindings.rd_kafka_topic_partition_list_add(
|
|
172
|
-
pointer,
|
|
173
|
-
"topic",
|
|
174
|
-
0
|
|
175
|
-
)
|
|
176
|
-
Rdkafka::Bindings.rd_kafka_topic_partition_list_set_offset(
|
|
177
|
-
pointer,
|
|
178
|
-
"topic",
|
|
179
|
-
0,
|
|
180
|
-
100
|
|
181
|
-
)
|
|
182
|
-
list = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(pointer)
|
|
183
|
-
|
|
184
|
-
other = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
185
|
-
list.add_topic_and_partitions_with_offsets("topic", 0 => 100)
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
expect(list).to eq other
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
describe "#to_native_tpl" do
|
|
193
|
-
it "should create a native list" do
|
|
194
|
-
list = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
195
|
-
list.add_topic("topic")
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
tpl = list.to_native_tpl
|
|
199
|
-
|
|
200
|
-
other = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(tpl)
|
|
201
|
-
|
|
202
|
-
expect(list).to eq other
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
it "should create a native list with partitions" do
|
|
206
|
-
list = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
207
|
-
list.add_topic("topic", 0..16)
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
tpl = list.to_native_tpl
|
|
211
|
-
|
|
212
|
-
other = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(tpl)
|
|
213
|
-
|
|
214
|
-
expect(list).to eq other
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
it "should create a native list with offsets" do
|
|
218
|
-
list = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
219
|
-
list.add_topic_and_partitions_with_offsets("topic", 0 => 100)
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
tpl = list.to_native_tpl
|
|
223
|
-
|
|
224
|
-
other = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(tpl)
|
|
225
|
-
|
|
226
|
-
expect(list).to eq other
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
it "should create a native list with timetamp offsets if offsets are Time" do
|
|
230
|
-
list = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
231
|
-
list.add_topic_and_partitions_with_offsets("topic", 0 => Time.at(1505069646, 250_000))
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
tpl = list.to_native_tpl
|
|
235
|
-
|
|
236
|
-
compare_list = Rdkafka::Consumer::TopicPartitionList.new.tap do |list|
|
|
237
|
-
list.add_topic_and_partitions_with_offsets(
|
|
238
|
-
"topic",
|
|
239
|
-
0 => (Time.at(1505069646, 250_000).to_f * 1000).floor
|
|
240
|
-
)
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
native_list = Rdkafka::Consumer::TopicPartitionList.from_native_tpl(tpl)
|
|
244
|
-
|
|
245
|
-
expect(native_list).to eq compare_list
|
|
246
|
-
end
|
|
247
|
-
end
|
|
248
|
-
end
|