karafka 2.0.35 → 2.0.37

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: e2d2197fb0fe7eae8db43cc45ffbdcdc6da83d60731ae63b82dc4a24d852736e
4
- data.tar.gz: 76b4b3f8ffb915b96a16f1eb83503283e5da46039fb952af383322773c4be551
3
+ metadata.gz: bab9c1d7bc952b4ecbfc4fad794d7e7c861cd3a332cc5d9058cef6c0bd9b57cb
4
+ data.tar.gz: 7662bd8dc5748d9112f3c72b2912619534e45750188f78df2f69a7e6ae1f9c31
5
5
  SHA512:
6
- metadata.gz: 35d69a8fa9a26462f2167174d8700648909bbcf38363c5adef2f7ee42995b524c0d244bffe0bd76698f65df5475db78b38914f38d7eda239376c4031555ee885
7
- data.tar.gz: 49a2256930ce83bc46b6471cf702b1ea2fe6f897a805f92e4dee7c3d9034a9625a44ecff0222b8396ed73858af5571cca4eaabca8d188a81312312c2225daa97
6
+ metadata.gz: 9a99a84d538a74bd27d5a0f585a12dbbe67eb76ab63cc1a0984cbe1562f230070ad482418f85393a3a479e81534a0957a0863c91f3a7f5b6433f74efd317c79e
7
+ data.tar.gz: 7da6129cd795f65d821bae897864648e4a5e37c0d07e8745f110f0d03a23d688d7717ab6c42652c4660fe3be3d26ee7051a8c2c66c1fcb62834a1c4159bd4ac4
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 2.0.37 (2023-03-20)
4
+ - [Fix] Declarative topics execution on a secondary cluster run topics creation on the primary one (#1365)
5
+ - [Fix] Admin read operations commit offset when not needed (#1369)
6
+
7
+ ## 2.0.36 (2023-03-17)
8
+ - [Refactor] Rename internal naming of `Structurable` to `Declaratives` for declarative topics feature.
9
+ - [Fix] AJ + DLQ + MOM + LRJ is pausing indefinitely after the first job (#1362)
10
+
3
11
  ## 2.0.35 (2023-03-13)
4
12
  - **[Feature]** Allow for defining topics config via the DSL and its automatic creation via CLI command.
5
13
  - **[Feature]** Allow for full topics reset and topics repartitioning via the CLI.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (2.0.35)
4
+ karafka (2.0.37)
5
5
  karafka-core (>= 2.0.12, < 3.0.0)
6
6
  thor (>= 0.20)
7
7
  waterdrop (>= 2.4.10, < 3.0.0)
@@ -45,10 +45,10 @@ en:
45
45
  dead_letter_queue.topic_format: 'needs to be a string with a Kafka accepted format'
46
46
  dead_letter_queue.active_format: needs to be either true or false
47
47
  active_format: needs to be either true or false
48
- structurable.partitions_format: needs to be more or equal to 1
49
- structurable.active_format: needs to be true
50
- structurable.replication_factor_format: needs to be more or equal to 1
51
- structurable.details_format: needs to be a hash with only symbol keys
48
+ declaratives.partitions_format: needs to be more or equal to 1
49
+ declaratives.active_format: needs to be true
50
+ declaratives.replication_factor_format: needs to be more or equal to 1
51
+ declaratives.details_format: needs to be a hash with only symbol keys
52
52
  inconsistent_namespacing: |
53
53
  needs to be consistent namespacing style
54
54
  disable this validation by setting config.strict_topics_namespacing to false
data/lib/karafka/admin.rb CHANGED
@@ -28,7 +28,10 @@ module Karafka
28
28
  'enable.partition.eof': true,
29
29
  'statistics.interval.ms': 0,
30
30
  # Fetch at most 5 MBs when using admin
31
- 'fetch.message.max.bytes': 5 * 1_048_576
31
+ 'fetch.message.max.bytes': 5 * 1_048_576,
32
+ # Do not commit offset automatically, this prevents offset tracking for operations involving
33
+ # a consumer instance
34
+ 'enable.auto.commit': false
32
35
  }.freeze
33
36
 
34
37
  private_constant :Topic, :CONFIG_DEFAULTS, :MAX_WAIT_TIMEOUT, :MAX_ATTEMPTS
@@ -29,7 +29,7 @@ module Karafka
29
29
 
30
30
  # Creates topics based on the routing setup and configuration
31
31
  def create
32
- structurable_routing_topics.each do |topic|
32
+ declaratives_routing_topics.each do |topic|
33
33
  name = topic.name
34
34
 
35
35
  if existing_topics_names.include?(name)
@@ -38,9 +38,9 @@ module Karafka
38
38
  puts "Creating topic #{name}..."
39
39
  Admin.create_topic(
40
40
  name,
41
- topic.structurable.partitions,
42
- topic.structurable.replication_factor,
43
- topic.structurable.details
41
+ topic.declaratives.partitions,
42
+ topic.declaratives.replication_factor,
43
+ topic.declaratives.details
44
44
  )
45
45
  puts "#{green('Created')} topic #{name}."
46
46
  end
@@ -49,7 +49,7 @@ module Karafka
49
49
 
50
50
  # Deletes routing based topics
51
51
  def delete
52
- structurable_routing_topics.each do |topic|
52
+ declaratives_routing_topics.each do |topic|
53
53
  name = topic.name
54
54
 
55
55
  if existing_topics_names.include?(name)
@@ -89,7 +89,7 @@ module Karafka
89
89
  [topic.fetch(:topic_name), topic.fetch(:partition_count)]
90
90
  end.to_h
91
91
 
92
- structurable_routing_topics.each do |topic|
92
+ declaratives_routing_topics.each do |topic|
93
93
  name = topic.name
94
94
 
95
95
  desired_count = topic.config.partitions
@@ -112,21 +112,24 @@ module Karafka
112
112
  # @note If topic is defined in multiple consumer groups, first config will be used. This
113
113
  # means, that this CLI will not work for simultaneous management of multiple clusters from
114
114
  # a single CLI command execution flow.
115
- def structurable_routing_topics
116
- return @structurable_routing_topics if @structurable_routing_topics
115
+ def declaratives_routing_topics
116
+ return @declaratives_routing_topics if @declaratives_routing_topics
117
117
 
118
118
  collected_topics = {}
119
+ default_servers = Karafka::App.config.kafka[:'bootstrap.servers']
119
120
 
120
121
  App.consumer_groups.each do |consumer_group|
121
122
  consumer_group.topics.each do |topic|
122
123
  # Skip topics that were explicitly disabled from management
123
- next unless topic.structurable.active?
124
+ next unless topic.declaratives.active?
125
+ # If bootstrap servers are different, consider this a different cluster
126
+ next unless default_servers == topic.kafka[:'bootstrap.servers']
124
127
 
125
128
  collected_topics[topic.name] ||= topic
126
129
  end
127
130
  end
128
131
 
129
- @structurable_routing_topics = collected_topics.values
132
+ @declaratives_routing_topics = collected_topics.values
130
133
  end
131
134
 
132
135
  # @return [Array<Hash>] existing topics details
@@ -23,8 +23,10 @@ module Karafka
23
23
  # This case is a bit of special. Please see the `AjDlqMom` for explanation on how the
24
24
  # offset management works in this case.
25
25
  module AjDlqLrjMom
26
- include AjLrjMom
27
- include AjDlqMom
26
+ # We can use the same code as for VP because non VP behaves like:
27
+ # - with one virtual partition
28
+ # - with "never ending" collapse
29
+ include AjDlqLrjMomVp
28
30
 
29
31
  # Features for this strategy
30
32
  FEATURES = %i[
@@ -3,8 +3,8 @@
3
3
  module Karafka
4
4
  module Routing
5
5
  module Features
6
- class Structurable < Base
7
- # Config for structurable feature
6
+ class Declaratives < Base
7
+ # Config for declarative topics feature
8
8
  Config = Struct.new(
9
9
  :active,
10
10
  :partitions,
@@ -3,7 +3,7 @@
3
3
  module Karafka
4
4
  module Routing
5
5
  module Features
6
- class Structurable < Base
6
+ class Declaratives < Base
7
7
  # Basic validation of the Kafka expected config details
8
8
  class Contract < Contracts::Base
9
9
  configure do |config|
@@ -14,7 +14,7 @@ module Karafka
14
14
  ).fetch('en').fetch('validations').fetch('topic')
15
15
  end
16
16
 
17
- nested :structurable do
17
+ nested :declaratives do
18
18
  required(:active) { |val| [true, false].include?(val) }
19
19
  required(:partitions) { |val| val.is_a?(Integer) && val.positive? }
20
20
  required(:replication_factor) { |val| val.is_a?(Integer) && val.positive? }
@@ -3,7 +3,7 @@
3
3
  module Karafka
4
4
  module Routing
5
5
  module Features
6
- class Structurable < Base
6
+ class Declaratives < Base
7
7
  # Extension for managing Kafka topic configuration
8
8
  module Topic
9
9
  # @param active [Boolean] is the topic structure management feature active
@@ -12,7 +12,7 @@ module Karafka
12
12
  # @param details [Hash] extra configuration for the topic
13
13
  # @return [Config] defined structure
14
14
  def config(active: true, partitions: 1, replication_factor: 1, **details)
15
- @structurable ||= Config.new(
15
+ @declaratives ||= Config.new(
16
16
  active: active,
17
17
  partitions: partitions,
18
18
  replication_factor: replication_factor,
@@ -21,20 +21,20 @@ module Karafka
21
21
  end
22
22
 
23
23
  # @return [Config] config details
24
- def structurable
24
+ def declaratives
25
25
  config
26
26
  end
27
27
 
28
- # @return [true] structurable is always active
29
- def structurable?
30
- structurable.active?
28
+ # @return [true] declaratives is always active
29
+ def declaratives?
30
+ declaratives.active?
31
31
  end
32
32
 
33
- # @return [Hash] topic with all its native configuration options plus structurable
33
+ # @return [Hash] topic with all its native configuration options plus declaratives
34
34
  # settings
35
35
  def to_h
36
36
  super.merge(
37
- structurable: structurable.to_h
37
+ declaratives: declaratives.to_h
38
38
  ).freeze
39
39
  end
40
40
  end
@@ -7,7 +7,7 @@ module Karafka
7
7
  # topics structure for test/development, etc. This allows to share the same set of settings
8
8
  # for topics despite the environment. Pretty much similar to how the `structure.sql` or
9
9
  # `schema.rb` operate for SQL dbs.
10
- class Structurable < Base
10
+ class Declaratives < Base
11
11
  end
12
12
  end
13
13
  end
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.35'
6
+ VERSION = '2.0.37'
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.35
4
+ version: 2.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-03-13 00:00:00.000000000 Z
38
+ date: 2023-03-20 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
@@ -306,14 +306,14 @@ files:
306
306
  - lib/karafka/routing/features/dead_letter_queue/config.rb
307
307
  - lib/karafka/routing/features/dead_letter_queue/contract.rb
308
308
  - lib/karafka/routing/features/dead_letter_queue/topic.rb
309
+ - lib/karafka/routing/features/declaratives.rb
310
+ - lib/karafka/routing/features/declaratives/config.rb
311
+ - lib/karafka/routing/features/declaratives/contract.rb
312
+ - lib/karafka/routing/features/declaratives/topic.rb
309
313
  - lib/karafka/routing/features/manual_offset_management.rb
310
314
  - lib/karafka/routing/features/manual_offset_management/config.rb
311
315
  - lib/karafka/routing/features/manual_offset_management/contract.rb
312
316
  - lib/karafka/routing/features/manual_offset_management/topic.rb
313
- - lib/karafka/routing/features/structurable.rb
314
- - lib/karafka/routing/features/structurable/config.rb
315
- - lib/karafka/routing/features/structurable/contract.rb
316
- - lib/karafka/routing/features/structurable/topic.rb
317
317
  - lib/karafka/routing/proxy.rb
318
318
  - lib/karafka/routing/router.rb
319
319
  - lib/karafka/routing/subscription_group.rb
metadata.gz.sig CHANGED
Binary file