karafka-rdkafka 0.15.1 → 0.16.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8581d403b8949abb8f13bc4e0584481bb84c6a139155030670199214b1d4bd91
4
- data.tar.gz: 5a1237797790d1be1f43356fa1975ddaab86517b135724c599dd90aa546d7348
3
+ metadata.gz: f42274ae25769bb5ac70ea53d4137270dac420dc9a8074175e5090304c6690df
4
+ data.tar.gz: dcc6c9d4cc815b5a742a95640b7131e5820042621006dd4bb776da578b0d9b22
5
5
  SHA512:
6
- metadata.gz: cb31bb629da594a562083cac971cbf70f3366e4efdd2b1a542f453d53a81fca9f054e80eee5a4d50bfc86f9b820dd2cc4bc6886f3cb5a39f8217c3936f05200d
7
- data.tar.gz: c6bace9ddc21367673887408d387eb3fe14a81aca2cf627c2f41d9163aee9b41d88ef68bbf88bf1f8097b35de00aa66d8c5cdabc300435db970dc93581d1a46e
6
+ metadata.gz: 72ba8300c81ef41c947788a4329c531f64bca9a255bf147da2477c23a6481d485e6f1a6eefdd3c348c966c4980f6c56bc9b25c2dddf7bed3783816548ce761b3
7
+ data.tar.gz: 3a7282405f3b58ac8bd3ddbd197256dbfa15e64384cef03370ba6cb3fe87967a2978ea2e9b6532d532f0a38e55ca823d94da14d46b0603238e1a37027411949f
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �����ƫ�����r-ti&� +[����� st����ԭ�e��U:�pM�3B���.�t�R� �����y�Y�7�T�v.n�X7�U�}o:���-Jם�)�(]P�D�8.�ڳ���"V��%4V� U��N&'X6�������Գ3�d<�1�|��T2��#c��B|0#J"�B�;D�>��z��<���⎟\���Wr�@�>�\"�3YoD�1�,Tc� }c�0Ǡi���[z쟀6�\.��.��Aϫ��kR��6V 꾥��jխVV;T�M#s�����x�۾bg�=0Ѝ&�L!v�x�q&�\��:�2ʈh_��.Z,��z��1��?�U��ԡ$�w��,��YK�=s�M��8�Q]L\'�|���)����
1
+ x#
2
+ (�I��Ŝjt��x��^o��?��>�'S:k�
@@ -22,11 +22,11 @@ jobs:
22
22
  fail-fast: false
23
23
  matrix:
24
24
  ruby:
25
+ - '3.4.0-preview1'
25
26
  - '3.3'
26
27
  - '3.2'
27
28
  - '3.1'
28
29
  - '3.0'
29
- - '2.7'
30
30
  include:
31
31
  - ruby: '3.3'
32
32
  coverage: 'true'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.1
1
+ 3.3.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Rdkafka Changelog
2
2
 
3
+ ## 0.16.0 (Unreleased)
4
+ - **[Breaking]** Messages without headers returned by `#poll` contain frozen empty hash.
5
+ - **[Breaking]** `HashWithSymbolKeysTreatedLikeStrings` has been removed so headers are regular hashes with string keys.
6
+ - [Enhancement] Bump librdkafka to 2.4.0
7
+ - [Enhancement] Save two objects on message produced and lower CPU usage on message produced with small improvements.
8
+ - [Fix] Remove support for Ruby 2.7. Supporting it was a bug since rest of the karafka ecosystem no longer supports it.
9
+
3
10
  ## 0.15.1 (2024-05-09)
4
11
  - **[Feature]** Provide ability to use topic config on a producer for custom behaviors per dispatch.
5
12
  - [Enhancement] Use topic config reference cache for messages production to prevent topic objects allocation with each message.
data/README.md CHANGED
@@ -163,6 +163,7 @@ bundle exec rake produce_messages
163
163
 
164
164
  | rdkafka-ruby | librdkafka |
165
165
  |-|-|
166
+ | 0.16.0 (2024-06-13) | 2.3.0 (2023-10-25) |
166
167
  | 0.15.0 (2023-12-03) | 2.3.0 (2023-10-25) |
167
168
  | 0.14.0 (2023-11-21) | 2.2.0 (2023-07-12) |
168
169
  | 0.13.0 (2023-07-24) | 2.0.2 (2023-01-20) |
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.name = 'karafka-rdkafka'
16
16
  gem.require_paths = ['lib']
17
17
  gem.version = Rdkafka::VERSION
18
- gem.required_ruby_version = '>= 2.7'
18
+ gem.required_ruby_version = '>= 3.0'
19
19
  gem.extensions = %w(ext/Rakefile)
20
20
  gem.cert_chain = %w[certs/cert_chain.pem]
21
21
 
@@ -4,17 +4,7 @@ module Rdkafka
4
4
  class Consumer
5
5
  # Interface to return headers for a consumer message
6
6
  module Headers
7
- class HashWithSymbolKeysTreatedLikeStrings < Hash
8
- def [](key)
9
- if key.is_a?(Symbol)
10
- Kernel.warn("rdkafka deprecation warning: header access with Symbol key #{key.inspect} treated as a String. " \
11
- "Please change your code to use String keys to avoid this warning. Symbol keys will break in version 1.")
12
- super(key.to_s)
13
- else
14
- super
15
- end
16
- end
17
- end
7
+ EMPTY_HEADERS = {}.freeze
18
8
 
19
9
  # Reads a librdkafka native message's headers and returns them as a Ruby Hash
20
10
  #
@@ -28,7 +18,7 @@ module Rdkafka
28
18
  err = Rdkafka::Bindings.rd_kafka_message_headers(native_message, headers_ptrptr)
29
19
 
30
20
  if err == Rdkafka::Bindings::RD_KAFKA_RESP_ERR__NOENT
31
- return {}
21
+ return EMPTY_HEADERS
32
22
  elsif err != Rdkafka::Bindings::RD_KAFKA_RESP_ERR_NO_ERROR
33
23
  raise Rdkafka::RdkafkaError.new(err, "Error reading message headers")
34
24
  end
@@ -39,7 +29,7 @@ module Rdkafka
39
29
  value_ptrptr = FFI::MemoryPointer.new(:pointer)
40
30
  size_ptr = Rdkafka::Bindings::SizePtr.new
41
31
 
42
- headers = HashWithSymbolKeysTreatedLikeStrings.new
32
+ headers = {}
43
33
 
44
34
  idx = 0
45
35
  loop do
@@ -14,6 +14,10 @@ module Rdkafka
14
14
  # @return [Object, nil] label set during message production or nil by default
15
15
  attr_accessor :label
16
16
 
17
+ # @return [String] topic where we are trying to send the message
18
+ # We use this instead of reading from `topic_name` pointer to save on memory allocations
19
+ attr_accessor :topic
20
+
17
21
  # @return [String] the name of the operation (e.g. "delivery")
18
22
  def operation_name
19
23
  "delivery"
@@ -25,7 +29,7 @@ module Rdkafka
25
29
  DeliveryReport.new(
26
30
  self[:partition],
27
31
  self[:offset],
28
- self[:topic_name].read_string,
32
+ topic,
29
33
  nil,
30
34
  label
31
35
  )
@@ -33,9 +37,7 @@ module Rdkafka
33
37
  DeliveryReport.new(
34
38
  self[:partition],
35
39
  self[:offset],
36
- # For part of errors, we will not get a topic name reference and in cases like this
37
- # we should not return it
38
- self[:topic_name].null? ? nil : self[:topic_name].read_string,
40
+ topic,
39
41
  Rdkafka::RdkafkaError.build(self[:response]),
40
42
  label
41
43
  )
@@ -381,6 +381,7 @@ module Rdkafka
381
381
 
382
382
  delivery_handle = DeliveryHandle.new
383
383
  delivery_handle.label = label
384
+ delivery_handle.topic = topic
384
385
  delivery_handle[:pending] = true
385
386
  delivery_handle[:response] = -1
386
387
  delivery_handle[:partition] = -1
@@ -404,7 +405,7 @@ module Rdkafka
404
405
  args << :int << Rdkafka::Bindings::RD_KAFKA_VTYPE_HEADER
405
406
  args << :string << key
406
407
  args << :pointer << value
407
- args << :size_t << value.bytes.size
408
+ args << :size_t << value.bytesize
408
409
  end
409
410
  end
410
411
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rdkafka
4
- VERSION = "0.15.1"
5
- LIBRDKAFKA_VERSION = "2.3.0"
6
- LIBRDKAFKA_SOURCE_SHA256 = "2d49c35c77eeb3d42fa61c43757fcbb6a206daa560247154e60642bcdcc14d12"
4
+ VERSION = "0.16.0.rc1"
5
+ LIBRDKAFKA_VERSION = "2.4.0"
6
+ LIBRDKAFKA_SOURCE_SHA256 = "d645e47d961db47f1ead29652606a502bdd2a880c85c1e060e94eea040f1a19a"
7
7
  end
@@ -34,7 +34,7 @@ describe Rdkafka::Admin do
34
34
  describe '#describe_errors' do
35
35
  let(:errors) { admin.class.describe_errors }
36
36
 
37
- it { expect(errors.size).to eq(162) }
37
+ it { expect(errors.size).to eq(168) }
38
38
  it { expect(errors[-184]).to eq(code: -184, description: 'Local: Queue full', name: '_QUEUE_FULL') }
39
39
  it { expect(errors[21]).to eq(code: 21, description: 'Broker: Invalid required acks value', name: 'INVALID_REQUIRED_ACKS') }
40
40
  end
@@ -50,11 +50,8 @@ describe Rdkafka::Consumer::Headers do
50
50
  expect(subject['version']).to eq("2.1.3")
51
51
  end
52
52
 
53
- it 'allows Symbol key, but warns' do
54
- expect(Kernel).to \
55
- receive(:warn).with("rdkafka deprecation warning: header access with Symbol key :version treated as a String. " \
56
- "Please change your code to use String keys to avoid this warning. Symbol keys will break in version 1.")
57
- expect(subject[:version]).to eq("2.1.3")
53
+ it 'does not support symbols mappings' do
54
+ expect(subject.key?(:version)).to eq(false)
58
55
  end
59
56
  end
60
57
  end
@@ -9,7 +9,7 @@ describe Rdkafka::Producer::DeliveryHandle do
9
9
  handle[:response] = response
10
10
  handle[:partition] = 2
11
11
  handle[:offset] = 100
12
- handle[:topic_name] = FFI::MemoryPointer.from_string("produce_test_topic")
12
+ handle.topic = "produce_test_topic"
13
13
  end
14
14
  end
15
15
 
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.15.1
4
+ version: 0.16.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thijs Cadier
@@ -36,7 +36,7 @@ cert_chain:
36
36
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
37
37
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
38
38
  -----END CERTIFICATE-----
39
- date: 2024-05-09 00:00:00.000000000 Z
39
+ date: 2024-06-17 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ffi
@@ -278,14 +278,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
278
  requirements:
279
279
  - - ">="
280
280
  - !ruby/object:Gem::Version
281
- version: '2.7'
281
+ version: '3.0'
282
282
  required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  requirements:
284
284
  - - ">="
285
285
  - !ruby/object:Gem::Version
286
286
  version: '0'
287
287
  requirements: []
288
- rubygems_version: 3.5.9
288
+ rubygems_version: 3.5.11
289
289
  signing_key:
290
290
  specification_version: 4
291
291
  summary: The rdkafka gem is a modern Kafka client library for Ruby based on librdkafka.
metadata.gz.sig CHANGED
Binary file