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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/config/locales/errors.yml +4 -4
- data/lib/karafka/admin.rb +4 -1
- data/lib/karafka/cli/topics.rb +13 -10
- data/lib/karafka/pro/processing/strategies/aj_dlq_lrj_mom.rb +4 -2
- data/lib/karafka/routing/features/{structurable → declaratives}/config.rb +2 -2
- data/lib/karafka/routing/features/{structurable → declaratives}/contract.rb +2 -2
- data/lib/karafka/routing/features/{structurable → declaratives}/topic.rb +8 -8
- data/lib/karafka/routing/features/{structurable.rb → declaratives.rb} +1 -1
- data/lib/karafka/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +6 -6
- 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: bab9c1d7bc952b4ecbfc4fad794d7e7c861cd3a332cc5d9058cef6c0bd9b57cb
|
4
|
+
data.tar.gz: 7662bd8dc5748d9112f3c72b2912619534e45750188f78df2f69a7e6ae1f9c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/config/locales/errors.yml
CHANGED
@@ -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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
data/lib/karafka/cli/topics.rb
CHANGED
@@ -29,7 +29,7 @@ module Karafka
|
|
29
29
|
|
30
30
|
# Creates topics based on the routing setup and configuration
|
31
31
|
def create
|
32
|
-
|
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.
|
42
|
-
topic.
|
43
|
-
topic.
|
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
|
-
|
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
|
-
|
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
|
116
|
-
return @
|
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.
|
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
|
-
@
|
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
|
-
|
27
|
-
|
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,7 +3,7 @@
|
|
3
3
|
module Karafka
|
4
4
|
module Routing
|
5
5
|
module Features
|
6
|
-
class
|
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 :
|
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
|
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
|
-
@
|
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
|
24
|
+
def declaratives
|
25
25
|
config
|
26
26
|
end
|
27
27
|
|
28
|
-
# @return [true]
|
29
|
-
def
|
30
|
-
|
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
|
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
|
-
|
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
|
10
|
+
class Declaratives < Base
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/karafka/version.rb
CHANGED
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.
|
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-
|
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
|