sbmt-kafka_consumer 2.1.0 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 260ec80f2e17f9aef25d51a0eba28f43cb8ea524c3d2d956dea2fd5a240123f3
4
- data.tar.gz: b302aac60dd45b5bb3da4af3e52e1a21f1fa5f4cd126837c68cbb50c20cc894a
3
+ metadata.gz: 466c2702a664bfe4ad5916c115dddb574e2108a990af6b686c5eea3298fd3a4c
4
+ data.tar.gz: 140e5ea106e9374df42dab0e372be5ff3c547a33882391a4634e368fc93b8737
5
5
  SHA512:
6
- metadata.gz: db36d1846f7b91745464ccd2a1e11b97553760e43715aae41e4cf7c0671c51cf7e35efc6b14eab9ed572ccabd21b5cdd10a4bf97b6fbf898bf4ddc83c728b2ac
7
- data.tar.gz: 631e701e0c5cc15e059faa00c6e5a55ef8d92f2ad45b0c4a8d7467150f668569f3f1796453b5e1596ab489b3dc32ac3d3ca6124431077c0ffd6d97158308adf7
6
+ metadata.gz: fc45d190f2cd0646049392a75c3f7d1a77db081669855f13b4d3dedb6f1a143cea6830659dbff9273fbde5517e3f11259e127ecb6c5a48a08cd4f6c71bbd93ea
7
+ data.tar.gz: 852f8c6da38cdb110cb5832d85f9798001f9b2fbf3db56c5b492cca4e44dcb3fc47639b60e4e5d143c8420a0b3f0c7e1467433f31861100c0578de62c6f49bec
data/.rubocop.yml CHANGED
@@ -18,7 +18,7 @@ AllCops:
18
18
  NewCops: enable
19
19
  SuggestExtensions: false
20
20
  TargetRubyVersion: 2.7
21
- TargetRailsVersion: 5.2
21
+ TargetRailsVersion: 6.0
22
22
  Exclude:
23
23
  - spec/internal/pkg/**/*
24
24
 
data/Appraisals CHANGED
@@ -3,11 +3,10 @@
3
3
  # See compatibility table at https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
4
4
 
5
5
  versions_map = {
6
- "5.2" => %w[2.7],
7
6
  "6.0" => %w[2.7],
8
7
  "6.1" => %w[2.7 3.0],
9
8
  "7.0" => %w[3.1],
10
- "7.1" => %w[3.2]
9
+ "7.1" => %w[3.2, 3.3]
11
10
  }
12
11
 
13
12
  current_ruby_version = RUBY_VERSION.split(".").first(2).join(".")
data/CHANGELOG.md CHANGED
@@ -13,6 +13,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
 
14
14
  ### Fixed
15
15
 
16
+ ## [2.3.0] - 2024-05-30
17
+
18
+ ### Added
19
+
20
+ - New config option `partition_assignment_strategy`
21
+
22
+ ### Changed
23
+
24
+ - Raise an exception when using the `partition.assignment.strategy` option within `kafka_options` for topics.
25
+
26
+ ## [2.2.0] - 2024-05-13
27
+
28
+ ### Changed
29
+
30
+ - Drop support for Rails 5.2
31
+ - Add support for Ruby 3.3
32
+
16
33
  ## [2.1.0] - 2024-05-13
17
34
 
18
35
  ### Added
data/Gemfile CHANGED
@@ -3,3 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
+
7
+ # FIXME: remove this after drop support for Ruby 2.7
8
+ gem "ffi", "< 1.17"
data/README.md CHANGED
@@ -69,6 +69,7 @@ default: &default
69
69
  pause_timeout: 1
70
70
  pause_max_timeout: 30
71
71
  pause_with_exponential_backoff: true
72
+ partition_assignment_strategy: cooperative-sticky
72
73
  auth:
73
74
  kind: plaintext
74
75
  kafka:
@@ -155,6 +156,7 @@ auth:
155
156
  The `servers` key is required and should be in rdkafka format: without `kafka://` prefix, for example: `srv1:port1,srv2:port2,...`.
156
157
 
157
158
  The `kafka_config` section may contain any [rdkafka option](https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md). Also, `kafka_options` may be redefined for each topic.
159
+ Please note that the `partition.assignment.strategy` option within kafka_options is not supported for topics; instead, use the global option partition_assignment_strategy.
158
160
 
159
161
  ### `consumer_groups` config section
160
162
 
@@ -6,6 +6,8 @@ default: &default
6
6
  pause_timeout: 1
7
7
  pause_max_timeout: 30
8
8
  pause_with_exponential_backoff: true
9
+ ## available strategies: range, roundrobin, cooperative-sticky
10
+ # partition_assignment_strategy: "range,roundrobin"
9
11
  auth:
10
12
  kind: plaintext
11
13
  kafka:
@@ -25,7 +25,7 @@ class Sbmt::KafkaConsumer::Config < Anyway::Config
25
25
 
26
26
  attr_config :client_id,
27
27
  :pause_timeout, :pause_max_timeout, :pause_with_exponential_backoff,
28
- :max_wait_time, :shutdown_timeout,
28
+ :max_wait_time, :shutdown_timeout, :partition_assignment_strategy,
29
29
  concurrency: 4, auth: {}, kafka: {}, consumer_groups: {}, probes: {}, metrics: {},
30
30
  deserializer_class: "::Sbmt::KafkaConsumer::Serialization::NullDeserializer",
31
31
  monitor_class: "::Sbmt::KafkaConsumer::Instrumentation::TracingMonitor",
@@ -45,6 +45,7 @@ class Sbmt::KafkaConsumer::Config < Anyway::Config
45
45
  pause_with_exponential_backoff: :boolean,
46
46
  max_wait_time: :integer,
47
47
  shutdown_timeout: :integer,
48
+ partition_assignment_strategy: :string,
48
49
  concurrency: :integer
49
50
 
50
51
  coerce_types kafka: coerce_to(Kafka)
@@ -54,7 +55,10 @@ class Sbmt::KafkaConsumer::Config < Anyway::Config
54
55
  coerce_types consumer_groups: coerce_to_array_of(ConsumerGroup)
55
56
 
56
57
  def to_kafka_options
57
- kafka.to_kafka_options
58
+ {
59
+ "partition.assignment.strategy": partition_assignment_strategy
60
+ }.compact
61
+ .merge(kafka.to_kafka_options)
58
62
  .merge(auth.to_kafka_options)
59
63
  end
60
64
 
@@ -64,6 +68,9 @@ class Sbmt::KafkaConsumer::Config < Anyway::Config
64
68
  consumer_groups.each do |cg|
65
69
  raise_validation_error "consumer group #{cg.id} must have at least one topic defined" if cg.topics.blank?
66
70
  cg.topics.each do |t|
71
+ if t.kafka_options.key?(:"partition.assignment.strategy")
72
+ raise_validation_error "Using the partition.assignment.strategy option for individual topics is not supported due to consuming issues. Use the global option `partition_assignment_strategy` instead"
73
+ end
67
74
  raise_validation_error "topic #{cg.id}.topics.name[#{t.name}] contains invalid consumer class: no const #{t.consumer.klass} defined" unless t.consumer.klass.safe_constantize
68
75
  raise_validation_error "topic #{cg.id}.topics.name[#{t.name}] contains invalid deserializer class: no const #{t.deserializer.klass} defined" unless t.deserializer&.klass&.safe_constantize
69
76
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sbmt
4
4
  module KafkaConsumer
5
- VERSION = "2.1.0"
5
+ VERSION = "2.3.0"
6
6
  end
7
7
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ["lib"]
33
33
 
34
- spec.add_dependency "rails", ">= 5.2"
34
+ spec.add_dependency "rails", ">= 6.0"
35
35
  spec.add_dependency "zeitwerk", "~> 2.3"
36
36
  spec.add_dependency "karafka", "~> 2.2", "< 2.4" # [Breaking] Drop the concept of consumer group mapping.
37
37
  spec.add_dependency "yabeda", ">= 0.11"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbmt-kafka_consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sbermarket Ruby-Platform Team
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: zeitwerk
29
29
  requirement: !ruby/object:Gem::Requirement