karafka-rdkafka 0.14.2 → 0.14.3
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/workflows/ci.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/lib/rdkafka/admin/acl_binding_result.rb +38 -24
- data/lib/rdkafka/bindings.rb +2 -1
- data/lib/rdkafka/consumer.rb +12 -14
- data/lib/rdkafka/version.rb +1 -1
- data/spec/rdkafka/admin/delete_acl_report_spec.rb +1 -0
- data/spec/rdkafka/admin/describe_acl_report_spec.rb +1 -0
- data/spec/rdkafka/consumer_spec.rb +10 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fee43511074dfab207280d7114f70f8fb5cc7b6055fdb348cd9da302ee037d2
|
4
|
+
data.tar.gz: 22656cc0b49a6d3aa7d6fad85c1b3c936b49089802ed07f4f43d8fdd85a16f2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdc7873ca1dda1d2afc6193c8e189850d5d3f865f19307cd997cc76c3fa39a919f2757ed610cf18854dc1ff61b270d1a9c85f880257c1c833435d7af9992a27a
|
7
|
+
data.tar.gz: ed37156d9f17e8be5804720b426424260c3e70567cf2e24dc385ed5e8d66763199fb056a2c47e11fec1ff80ddaae8b2926f9420b05d1c9e88dc38735c32b4eb1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Rdkafka Changelog
|
2
2
|
|
3
|
+
## 0.14.3 (2023-12-17)
|
4
|
+
- [Enhancement] Replace `rd_kafka_offset_store` with `rd_kafka_offsets_store` (mensfeld)
|
5
|
+
- [Fix] Missing ACL `RD_KAFKA_RESOURCE_BROKER` constant reference (mensfeld)
|
6
|
+
- [Change] Rename `matching_acl_pattern_type` to `matching_acl_resource_pattern_type` to align the whole API (mensfeld)
|
7
|
+
|
3
8
|
## 0.14.2 (2023-12-11)
|
4
9
|
- [Enhancement] Alias `topic_name` as `topic` in the delivery report (mensfeld)
|
5
10
|
- [Fix] Fix return type on `#rd_kafka_poll` (mensfeld)
|
@@ -2,36 +2,50 @@
|
|
2
2
|
|
3
3
|
module Rdkafka
|
4
4
|
class Admin
|
5
|
-
|
6
5
|
# Extracts attributes of rd_kafka_AclBinding_t
|
7
6
|
#
|
8
7
|
class AclBindingResult
|
9
|
-
attr_reader :result_error, :error_string, :matching_acl_resource_type,
|
8
|
+
attr_reader :result_error, :error_string, :matching_acl_resource_type,
|
9
|
+
:matching_acl_resource_name, :matching_acl_resource_pattern_type,
|
10
|
+
:matching_acl_principal, :matching_acl_host, :matching_acl_operation,
|
11
|
+
:matching_acl_permission_type
|
12
|
+
|
13
|
+
# This attribute was initially released under the name that is now an alias
|
14
|
+
# We keep it for backwards compatibility but it was changed for the consistency
|
15
|
+
alias matching_acl_pattern_type matching_acl_resource_pattern_type
|
10
16
|
|
11
17
|
def initialize(matching_acl)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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)
|
18
|
+
rd_kafka_error_pointer = Rdkafka::Bindings.rd_kafka_AclBinding_error(matching_acl)
|
19
|
+
@result_error = Rdkafka::Bindings.rd_kafka_error_code(rd_kafka_error_pointer)
|
20
|
+
error_string = Rdkafka::Bindings.rd_kafka_error_string(rd_kafka_error_pointer)
|
21
|
+
|
22
|
+
if error_string != FFI::Pointer::NULL
|
23
|
+
@error_string = error_string.read_string
|
34
24
|
end
|
25
|
+
|
26
|
+
@matching_acl_resource_type = Rdkafka::Bindings.rd_kafka_AclBinding_restype(matching_acl)
|
27
|
+
matching_acl_resource_name = Rdkafka::Bindings.rd_kafka_AclBinding_name(matching_acl)
|
28
|
+
|
29
|
+
if matching_acl_resource_name != FFI::Pointer::NULL
|
30
|
+
@matching_acl_resource_name = matching_acl_resource_name.read_string
|
31
|
+
end
|
32
|
+
|
33
|
+
@matching_acl_resource_pattern_type = Rdkafka::Bindings.rd_kafka_AclBinding_resource_pattern_type(matching_acl)
|
34
|
+
matching_acl_principal = Rdkafka::Bindings.rd_kafka_AclBinding_principal(matching_acl)
|
35
|
+
|
36
|
+
if matching_acl_principal != FFI::Pointer::NULL
|
37
|
+
@matching_acl_principal = matching_acl_principal.read_string
|
38
|
+
end
|
39
|
+
|
40
|
+
matching_acl_host = Rdkafka::Bindings.rd_kafka_AclBinding_host(matching_acl)
|
41
|
+
|
42
|
+
if matching_acl_host != FFI::Pointer::NULL
|
43
|
+
@matching_acl_host = matching_acl_host.read_string
|
44
|
+
end
|
45
|
+
|
46
|
+
@matching_acl_operation = Rdkafka::Bindings.rd_kafka_AclBinding_operation(matching_acl)
|
47
|
+
@matching_acl_permission_type = Rdkafka::Bindings.rd_kafka_AclBinding_permission_type(matching_acl)
|
35
48
|
end
|
49
|
+
end
|
36
50
|
end
|
37
51
|
end
|
data/lib/rdkafka/bindings.rb
CHANGED
@@ -199,7 +199,7 @@ module Rdkafka
|
|
199
199
|
attach_function :rd_kafka_poll_set_consumer, [:pointer], :void, blocking: true
|
200
200
|
attach_function :rd_kafka_consumer_poll, [:pointer, :int], :pointer, blocking: true
|
201
201
|
attach_function :rd_kafka_consumer_close, [:pointer], :void, blocking: true
|
202
|
-
attach_function :
|
202
|
+
attach_function :rd_kafka_offsets_store, [:pointer, :pointer], :int, blocking: true
|
203
203
|
attach_function :rd_kafka_pause_partitions, [:pointer, :pointer], :int, blocking: true
|
204
204
|
attach_function :rd_kafka_resume_partitions, [:pointer, :pointer], :int, blocking: true
|
205
205
|
attach_function :rd_kafka_seek, [:pointer, :int32, :int64, :int], :int, blocking: true
|
@@ -412,6 +412,7 @@ module Rdkafka
|
|
412
412
|
RD_KAFKA_RESOURCE_ANY = 1
|
413
413
|
RD_KAFKA_RESOURCE_TOPIC = 2
|
414
414
|
RD_KAFKA_RESOURCE_GROUP = 3
|
415
|
+
RD_KAFKA_RESOURCE_BROKER = 4
|
415
416
|
|
416
417
|
# rd_kafka_ResourcePatternType_t - https://github.com/confluentinc/librdkafka/blob/292d2a66b9921b783f08147807992e603c7af059/src/rdkafka.h#L7320
|
417
418
|
|
data/lib/rdkafka/consumer.rb
CHANGED
@@ -388,28 +388,26 @@ module Rdkafka
|
|
388
388
|
def store_offset(message)
|
389
389
|
closed_consumer_check(__method__)
|
390
390
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
391
|
+
list = TopicPartitionList.new
|
392
|
+
list.add_topic_and_partitions_with_offsets(
|
393
|
+
message.topic,
|
394
|
+
message.partition => message.offset + 1
|
395
|
+
)
|
396
|
+
|
397
|
+
tpl = list.to_native_tpl
|
398
|
+
|
399
|
+
response = @native_kafka.with_inner do |inner|
|
400
|
+
Rdkafka::Bindings.rd_kafka_offsets_store(
|
395
401
|
inner,
|
396
|
-
|
397
|
-
nil
|
402
|
+
tpl
|
398
403
|
)
|
399
404
|
end
|
400
|
-
response = Rdkafka::Bindings.rd_kafka_offset_store(
|
401
|
-
native_topic,
|
402
|
-
message.partition,
|
403
|
-
message.offset
|
404
|
-
)
|
405
405
|
|
406
406
|
Rdkafka::RdkafkaError.validate!(response)
|
407
407
|
|
408
408
|
nil
|
409
409
|
ensure
|
410
|
-
if
|
411
|
-
Rdkafka::Bindings.rd_kafka_topic_destroy(native_topic)
|
412
|
-
end
|
410
|
+
Rdkafka::Bindings.rd_kafka_topic_partition_list_destroy(tpl) if tpl
|
413
411
|
end
|
414
412
|
|
415
413
|
# Seek to a particular message. The next poll on the topic/partition will return the
|
data/lib/rdkafka/version.rb
CHANGED
@@ -50,6 +50,7 @@ describe Rdkafka::Admin::DeleteAclReport do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should get deleted acl resource pattern type as Rdkafka::Bindings::RD_KAFKA_RESOURCE_PATTERN_LITERAL" do
|
53
|
+
expect(subject.deleted_acls[0].matching_acl_resource_pattern_type).to eq(Rdkafka::Bindings::RD_KAFKA_RESOURCE_PATTERN_LITERAL)
|
53
54
|
expect(subject.deleted_acls[0].matching_acl_pattern_type).to eq(Rdkafka::Bindings::RD_KAFKA_RESOURCE_PATTERN_LITERAL)
|
54
55
|
end
|
55
56
|
|
@@ -51,6 +51,7 @@ describe Rdkafka::Admin::DescribeAclReport do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should get matching acl resource pattern type as Rdkafka::Bindings::RD_KAFKA_RESOURCE_PATTERN_LITERAL" do
|
54
|
+
expect(subject.acls[0].matching_acl_resource_pattern_type).to eq(Rdkafka::Bindings::RD_KAFKA_RESOURCE_PATTERN_LITERAL)
|
54
55
|
expect(subject.acls[0].matching_acl_pattern_type).to eq(Rdkafka::Bindings::RD_KAFKA_RESOURCE_PATTERN_LITERAL)
|
55
56
|
end
|
56
57
|
|
@@ -480,6 +480,8 @@ describe Rdkafka::Consumer do
|
|
480
480
|
end
|
481
481
|
|
482
482
|
describe "#store_offset" do
|
483
|
+
let(:consumer) { rdkafka_consumer_config('enable.auto.offset.store': false).consumer }
|
484
|
+
|
483
485
|
before do
|
484
486
|
config = {}
|
485
487
|
config[:'enable.auto.offset.store'] = false
|
@@ -542,6 +544,14 @@ describe Rdkafka::Consumer do
|
|
542
544
|
}.to raise_error(Rdkafka::RdkafkaError)
|
543
545
|
end
|
544
546
|
end
|
547
|
+
|
548
|
+
context "when trying to use with enable.auto.offset.store set to true" do
|
549
|
+
let(:consumer) { rdkafka_consumer_config('enable.auto.offset.store': true).consumer }
|
550
|
+
|
551
|
+
it "expect to raise invalid configuration error" do
|
552
|
+
expect { consumer.store_offset(message) }.to raise_error(Rdkafka::RdkafkaError, /invalid_arg/)
|
553
|
+
end
|
554
|
+
end
|
545
555
|
end
|
546
556
|
end
|
547
557
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka-rdkafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thijs Cadier
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
36
36
|
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-12-
|
38
|
+
date: 2023-12-17 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: ffi
|
metadata.gz.sig
CHANGED
Binary file
|