karafka-rdkafka 0.15.2 → 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: a9cfc42920e216878543e0ceb81d3f13930f43ecd14c954855d7f8d57824e4db
4
- data.tar.gz: 912bcbe8ace5d02f8add80de5fb026cd0bc6f37845339b373094d943610a3191
3
+ metadata.gz: f42274ae25769bb5ac70ea53d4137270dac420dc9a8074175e5090304c6690df
4
+ data.tar.gz: dcc6c9d4cc815b5a742a95640b7131e5820042621006dd4bb776da578b0d9b22
5
5
  SHA512:
6
- metadata.gz: 89ac5f595837ff33ce10eb4e3c50fbf21216069bb65498341fb2d1faf2646a7996be9eaf9a2d60c42d3e376190fbb06fb131134a1802258f154d6877cc854037
7
- data.tar.gz: e2152f5eddf2bd88b7ee2dc144dd91b22a5fc94e11615cac3d8ab869609a90576627363d8dc1ce58ebc52b55276bc1043b375d5faa4ef4c977b5ecb71b30f987
6
+ metadata.gz: 72ba8300c81ef41c947788a4329c531f64bca9a255bf147da2477c23a6481d485e6f1a6eefdd3c348c966c4980f6c56bc9b25c2dddf7bed3783816548ce761b3
7
+ data.tar.gz: 3a7282405f3b58ac8bd3ddbd197256dbfa15e64384cef03370ba6cb3fe87967a2978ea2e9b6532d532f0a38e55ca823d94da14d46b0603238e1a37027411949f
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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,7 +1,11 @@
1
1
  # Rdkafka Changelog
2
2
 
3
- ## 0.15.2 (2024-07-10)
4
- - [Fix] Switch to local release of librdkafka to mitigate its unavailability.
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.
5
9
 
6
10
  ## 0.15.1 (2024-05-09)
7
11
  - **[Feature]** Provide ability to use topic config on a producer for custom behaviors per dispatch.
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) |
data/ext/Rakefile CHANGED
@@ -22,10 +22,8 @@ task :default => :clean do
22
22
  ENV["LDFLAGS"] = "-L#{homebrew_prefix}/lib" unless ENV["LDFLAGS"]
23
23
  end
24
24
 
25
- releases = File.expand_path(File.join(File.dirname(__FILE__), '../dist'))
26
-
27
25
  recipe.files << {
28
- :url => "file://#{releases}/librdkafka_#{Rdkafka::LIBRDKAFKA_VERSION}.tar.gz",
26
+ :url => "https://codeload.github.com/edenhill/librdkafka/tar.gz/v#{Rdkafka::LIBRDKAFKA_VERSION}",
29
27
  :sha256 => Rdkafka::LIBRDKAFKA_SOURCE_SHA256
30
28
  }
31
29
  recipe.configure_options = ["--host=#{recipe.host}"]
@@ -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.2"
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.2
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-07-10 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
@@ -186,7 +186,6 @@ files:
186
186
  - README.md
187
187
  - Rakefile
188
188
  - certs/cert_chain.pem
189
- - dist/librdkafka_2.3.0.tar.gz
190
189
  - docker-compose.yml
191
190
  - ext/README.md
192
191
  - ext/Rakefile
@@ -279,14 +278,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
278
  requirements:
280
279
  - - ">="
281
280
  - !ruby/object:Gem::Version
282
- version: '2.7'
281
+ version: '3.0'
283
282
  required_rubygems_version: !ruby/object:Gem::Requirement
284
283
  requirements:
285
284
  - - ">="
286
285
  - !ruby/object:Gem::Version
287
286
  version: '0'
288
287
  requirements: []
289
- rubygems_version: 3.5.9
288
+ rubygems_version: 3.5.11
290
289
  signing_key:
291
290
  specification_version: 4
292
291
  summary: The rdkafka gem is a modern Kafka client library for Ruby based on librdkafka.
metadata.gz.sig CHANGED
Binary file
Binary file