karafka 2.1.13 → 2.2.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +35 -0
  4. data/Gemfile.lock +1 -1
  5. data/config/locales/errors.yml +4 -0
  6. data/config/locales/pro_errors.yml +17 -0
  7. data/lib/karafka/admin.rb +21 -33
  8. data/lib/karafka/connection/client.rb +1 -1
  9. data/lib/karafka/contracts/config.rb +24 -0
  10. data/lib/karafka/pro/contracts/base.rb +23 -0
  11. data/lib/karafka/pro/contracts/server_cli_options.rb +111 -0
  12. data/lib/karafka/pro/loader.rb +4 -1
  13. data/lib/karafka/pro/routing/features/active_job/builder.rb +45 -0
  14. data/lib/karafka/pro/routing/features/active_job.rb +26 -0
  15. data/lib/karafka/pro/routing/features/dead_letter_queue/contracts/topic.rb +53 -0
  16. data/lib/karafka/pro/routing/features/delaying/contracts/topic.rb +41 -0
  17. data/lib/karafka/pro/routing/features/expiring/contracts/topic.rb +41 -0
  18. data/lib/karafka/pro/routing/features/filtering/contracts/topic.rb +44 -0
  19. data/lib/karafka/pro/routing/features/long_running_job/{contract.rb → contracts/topic.rb} +14 -11
  20. data/lib/karafka/pro/routing/features/{filtering/contract.rb → patterns/builder.rb} +13 -16
  21. data/lib/karafka/pro/routing/features/patterns/config.rb +54 -0
  22. data/lib/karafka/pro/routing/features/patterns/consumer_group.rb +68 -0
  23. data/lib/karafka/pro/routing/features/patterns/contracts/consumer_group.rb +62 -0
  24. data/lib/karafka/pro/routing/features/patterns/contracts/pattern.rb +46 -0
  25. data/lib/karafka/pro/routing/features/patterns/contracts/topic.rb +41 -0
  26. data/lib/karafka/pro/routing/features/patterns/detector.rb +68 -0
  27. data/lib/karafka/pro/routing/features/patterns/pattern.rb +81 -0
  28. data/lib/karafka/pro/routing/features/{delaying/contract.rb → patterns/patterns.rb} +11 -14
  29. data/lib/karafka/pro/routing/features/patterns/topic.rb +50 -0
  30. data/lib/karafka/pro/routing/features/patterns/topics.rb +53 -0
  31. data/lib/karafka/pro/routing/features/patterns.rb +33 -0
  32. data/lib/karafka/pro/routing/features/pausing/contracts/topic.rb +51 -0
  33. data/lib/karafka/pro/routing/features/throttling/contracts/topic.rb +44 -0
  34. data/lib/karafka/pro/routing/features/virtual_partitions/contracts/topic.rb +55 -0
  35. data/lib/karafka/routing/consumer_group.rb +1 -1
  36. data/lib/karafka/routing/features/active_job/contracts/topic.rb +44 -0
  37. data/lib/karafka/routing/features/active_job/proxy.rb +14 -0
  38. data/lib/karafka/routing/features/base/expander.rb +8 -2
  39. data/lib/karafka/routing/features/base.rb +4 -2
  40. data/lib/karafka/routing/features/dead_letter_queue/contracts/topic.rb +46 -0
  41. data/lib/karafka/routing/features/declaratives/contracts/topic.rb +33 -0
  42. data/lib/karafka/routing/features/manual_offset_management/contracts/topic.rb +27 -0
  43. data/lib/karafka/routing/router.rb +0 -11
  44. data/lib/karafka/routing/subscription_group.rb +9 -0
  45. data/lib/karafka/routing/topic.rb +5 -0
  46. data/lib/karafka/server.rb +9 -4
  47. data/lib/karafka/setup/config.rb +45 -0
  48. data/lib/karafka/version.rb +1 -1
  49. data.tar.gz.sig +0 -0
  50. metadata +32 -15
  51. metadata.gz.sig +0 -0
  52. data/lib/karafka/pro/routing/features/dead_letter_queue/contract.rb +0 -50
  53. data/lib/karafka/pro/routing/features/expiring/contract.rb +0 -38
  54. data/lib/karafka/pro/routing/features/pausing/contract.rb +0 -48
  55. data/lib/karafka/pro/routing/features/throttling/contract.rb +0 -41
  56. data/lib/karafka/pro/routing/features/virtual_partitions/contract.rb +0 -52
  57. data/lib/karafka/routing/features/active_job/contract.rb +0 -41
  58. data/lib/karafka/routing/features/dead_letter_queue/contract.rb +0 -42
  59. data/lib/karafka/routing/features/declaratives/contract.rb +0 -30
  60. data/lib/karafka/routing/features/manual_offset_management/contract.rb +0 -24
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.1.13
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
36
36
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
37
37
  -----END CERTIFICATE-----
38
- date: 2023-08-28 00:00:00.000000000 Z
38
+ date: 2023-09-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
@@ -224,6 +224,8 @@ files:
224
224
  - lib/karafka/pro/cleaner/errors.rb
225
225
  - lib/karafka/pro/cleaner/messages/message.rb
226
226
  - lib/karafka/pro/cleaner/messages/messages.rb
227
+ - lib/karafka/pro/contracts/base.rb
228
+ - lib/karafka/pro/contracts/server_cli_options.rb
227
229
  - lib/karafka/pro/encryption.rb
228
230
  - lib/karafka/pro/encryption/cipher.rb
229
231
  - lib/karafka/pro/encryption/contracts/config.rb
@@ -301,35 +303,49 @@ files:
301
303
  - lib/karafka/pro/processing/strategies/vp/default.rb
302
304
  - lib/karafka/pro/processing/strategy_selector.rb
303
305
  - lib/karafka/pro/processing/virtual_offset_manager.rb
306
+ - lib/karafka/pro/routing/features/active_job.rb
307
+ - lib/karafka/pro/routing/features/active_job/builder.rb
304
308
  - lib/karafka/pro/routing/features/base.rb
305
309
  - lib/karafka/pro/routing/features/dead_letter_queue.rb
306
- - lib/karafka/pro/routing/features/dead_letter_queue/contract.rb
310
+ - lib/karafka/pro/routing/features/dead_letter_queue/contracts/topic.rb
307
311
  - lib/karafka/pro/routing/features/delaying.rb
308
312
  - lib/karafka/pro/routing/features/delaying/config.rb
309
- - lib/karafka/pro/routing/features/delaying/contract.rb
313
+ - lib/karafka/pro/routing/features/delaying/contracts/topic.rb
310
314
  - lib/karafka/pro/routing/features/delaying/topic.rb
311
315
  - lib/karafka/pro/routing/features/expiring.rb
312
316
  - lib/karafka/pro/routing/features/expiring/config.rb
313
- - lib/karafka/pro/routing/features/expiring/contract.rb
317
+ - lib/karafka/pro/routing/features/expiring/contracts/topic.rb
314
318
  - lib/karafka/pro/routing/features/expiring/topic.rb
315
319
  - lib/karafka/pro/routing/features/filtering.rb
316
320
  - lib/karafka/pro/routing/features/filtering/config.rb
317
- - lib/karafka/pro/routing/features/filtering/contract.rb
321
+ - lib/karafka/pro/routing/features/filtering/contracts/topic.rb
318
322
  - lib/karafka/pro/routing/features/filtering/topic.rb
319
323
  - lib/karafka/pro/routing/features/long_running_job.rb
320
324
  - lib/karafka/pro/routing/features/long_running_job/config.rb
321
- - lib/karafka/pro/routing/features/long_running_job/contract.rb
325
+ - lib/karafka/pro/routing/features/long_running_job/contracts/topic.rb
322
326
  - lib/karafka/pro/routing/features/long_running_job/topic.rb
327
+ - lib/karafka/pro/routing/features/patterns.rb
328
+ - lib/karafka/pro/routing/features/patterns/builder.rb
329
+ - lib/karafka/pro/routing/features/patterns/config.rb
330
+ - lib/karafka/pro/routing/features/patterns/consumer_group.rb
331
+ - lib/karafka/pro/routing/features/patterns/contracts/consumer_group.rb
332
+ - lib/karafka/pro/routing/features/patterns/contracts/pattern.rb
333
+ - lib/karafka/pro/routing/features/patterns/contracts/topic.rb
334
+ - lib/karafka/pro/routing/features/patterns/detector.rb
335
+ - lib/karafka/pro/routing/features/patterns/pattern.rb
336
+ - lib/karafka/pro/routing/features/patterns/patterns.rb
337
+ - lib/karafka/pro/routing/features/patterns/topic.rb
338
+ - lib/karafka/pro/routing/features/patterns/topics.rb
323
339
  - lib/karafka/pro/routing/features/pausing.rb
324
- - lib/karafka/pro/routing/features/pausing/contract.rb
340
+ - lib/karafka/pro/routing/features/pausing/contracts/topic.rb
325
341
  - lib/karafka/pro/routing/features/pausing/topic.rb
326
342
  - lib/karafka/pro/routing/features/throttling.rb
327
343
  - lib/karafka/pro/routing/features/throttling/config.rb
328
- - lib/karafka/pro/routing/features/throttling/contract.rb
344
+ - lib/karafka/pro/routing/features/throttling/contracts/topic.rb
329
345
  - lib/karafka/pro/routing/features/throttling/topic.rb
330
346
  - lib/karafka/pro/routing/features/virtual_partitions.rb
331
347
  - lib/karafka/pro/routing/features/virtual_partitions/config.rb
332
- - lib/karafka/pro/routing/features/virtual_partitions/contract.rb
348
+ - lib/karafka/pro/routing/features/virtual_partitions/contracts/topic.rb
333
349
  - lib/karafka/pro/routing/features/virtual_partitions/topic.rb
334
350
  - lib/karafka/process.rb
335
351
  - lib/karafka/processing/coordinator.rb
@@ -364,21 +380,22 @@ files:
364
380
  - lib/karafka/routing/features/active_job.rb
365
381
  - lib/karafka/routing/features/active_job/builder.rb
366
382
  - lib/karafka/routing/features/active_job/config.rb
367
- - lib/karafka/routing/features/active_job/contract.rb
383
+ - lib/karafka/routing/features/active_job/contracts/topic.rb
384
+ - lib/karafka/routing/features/active_job/proxy.rb
368
385
  - lib/karafka/routing/features/active_job/topic.rb
369
386
  - lib/karafka/routing/features/base.rb
370
387
  - lib/karafka/routing/features/base/expander.rb
371
388
  - lib/karafka/routing/features/dead_letter_queue.rb
372
389
  - lib/karafka/routing/features/dead_letter_queue/config.rb
373
- - lib/karafka/routing/features/dead_letter_queue/contract.rb
390
+ - lib/karafka/routing/features/dead_letter_queue/contracts/topic.rb
374
391
  - lib/karafka/routing/features/dead_letter_queue/topic.rb
375
392
  - lib/karafka/routing/features/declaratives.rb
376
393
  - lib/karafka/routing/features/declaratives/config.rb
377
- - lib/karafka/routing/features/declaratives/contract.rb
394
+ - lib/karafka/routing/features/declaratives/contracts/topic.rb
378
395
  - lib/karafka/routing/features/declaratives/topic.rb
379
396
  - lib/karafka/routing/features/manual_offset_management.rb
380
397
  - lib/karafka/routing/features/manual_offset_management/config.rb
381
- - lib/karafka/routing/features/manual_offset_management/contract.rb
398
+ - lib/karafka/routing/features/manual_offset_management/contracts/topic.rb
382
399
  - lib/karafka/routing/features/manual_offset_management/topic.rb
383
400
  - lib/karafka/routing/proxy.rb
384
401
  - lib/karafka/routing/router.rb
@@ -429,7 +446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
446
  - !ruby/object:Gem::Version
430
447
  version: '0'
431
448
  requirements: []
432
- rubygems_version: 3.4.10
449
+ rubygems_version: 3.4.19
433
450
  signing_key:
434
451
  specification_version: 4
435
452
  summary: Karafka is Ruby and Rails efficient Kafka processing framework.
metadata.gz.sig CHANGED
Binary file
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This Karafka component is a Pro component under a commercial license.
4
- # This Karafka component is NOT licensed under LGPL.
5
- #
6
- # All of the commercial components are present in the lib/karafka/pro directory of this
7
- # repository and their usage requires commercial license agreement.
8
- #
9
- # Karafka has also commercial-friendly license, commercial support and commercial components.
10
- #
11
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
12
- # your code to Maciej Mensfeld.
13
-
14
- module Karafka
15
- module Pro
16
- module Routing
17
- module Features
18
- class DeadLetterQueue < Base
19
- # Extended rules for dead letter queue settings
20
- class Contract < Contracts::Base
21
- configure do |config|
22
- config.error_messages = YAML.safe_load(
23
- File.read(
24
- File.join(Karafka.gem_root, 'config', 'locales', 'pro_errors.yml')
25
- )
26
- ).fetch('en').fetch('validations').fetch('topic')
27
- end
28
-
29
- # Make sure that when we use virtual partitions with DLQ, at least one retry is set
30
- # We cannot use VP with DLQ without retries as we in order to provide ordering
31
- # warranties on errors with VP, we need to collapse the VPs concurrency and retry
32
- # without any indeterministic work
33
- virtual do |data, errors|
34
- next unless errors.empty?
35
-
36
- dead_letter_queue = data[:dead_letter_queue]
37
- virtual_partitions = data[:virtual_partitions]
38
-
39
- next unless dead_letter_queue[:active]
40
- next unless virtual_partitions[:active]
41
- next if dead_letter_queue[:max_retries].positive?
42
-
43
- [[%i[dead_letter_queue], :with_virtual_partitions]]
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This Karafka component is a Pro component under a commercial license.
4
- # This Karafka component is NOT licensed under LGPL.
5
- #
6
- # All of the commercial components are present in the lib/karafka/pro directory of this
7
- # repository and their usage requires commercial license agreement.
8
- #
9
- # Karafka has also commercial-friendly license, commercial support and commercial components.
10
- #
11
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
12
- # your code to Maciej Mensfeld.
13
-
14
- module Karafka
15
- module Pro
16
- module Routing
17
- module Features
18
- class Expiring < Base
19
- # Contract to validate configuration of the expiring feature
20
- class Contract < Contracts::Base
21
- configure do |config|
22
- config.error_messages = YAML.safe_load(
23
- File.read(
24
- File.join(Karafka.gem_root, 'config', 'locales', 'pro_errors.yml')
25
- )
26
- ).fetch('en').fetch('validations').fetch('topic')
27
- end
28
-
29
- nested(:expiring) do
30
- required(:active) { |val| [true, false].include?(val) }
31
- required(:ttl) { |val| val.nil? || (val.is_a?(Integer) && val.positive?) }
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This Karafka component is a Pro component under a commercial license.
4
- # This Karafka component is NOT licensed under LGPL.
5
- #
6
- # All of the commercial components are present in the lib/karafka/pro directory of this
7
- # repository and their usage requires commercial license agreement.
8
- #
9
- # Karafka has also commercial-friendly license, commercial support and commercial components.
10
- #
11
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
12
- # your code to Maciej Mensfeld.
13
-
14
- module Karafka
15
- module Pro
16
- module Routing
17
- module Features
18
- class Pausing < Base
19
- # Contract to make sure, that the pause settings on a per topic basis are as expected
20
- class Contract < Contracts::Base
21
- configure do |config|
22
- config.error_messages = YAML.safe_load(
23
- File.read(
24
- File.join(Karafka.gem_root, 'config', 'locales', 'pro_errors.yml')
25
- )
26
- ).fetch('en').fetch('validations').fetch('topic')
27
-
28
- required(:pause_timeout) { |val| val.is_a?(Integer) && val.positive? }
29
- required(:pause_max_timeout) { |val| val.is_a?(Integer) && val.positive? }
30
- required(:pause_with_exponential_backoff) { |val| [true, false].include?(val) }
31
-
32
- virtual do |data, errors|
33
- next unless errors.empty?
34
-
35
- pause_timeout = data.fetch(:pause_timeout)
36
- pause_max_timeout = data.fetch(:pause_max_timeout)
37
-
38
- next if pause_timeout <= pause_max_timeout
39
-
40
- [[%i[pause_timeout], :max_timeout_vs_pause_max_timeout]]
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This Karafka component is a Pro component under a commercial license.
4
- # This Karafka component is NOT licensed under LGPL.
5
- #
6
- # All of the commercial components are present in the lib/karafka/pro directory of this
7
- # repository and their usage requires commercial license agreement.
8
- #
9
- # Karafka has also commercial-friendly license, commercial support and commercial components.
10
- #
11
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
12
- # your code to Maciej Mensfeld.
13
-
14
- module Karafka
15
- module Pro
16
- module Routing
17
- module Features
18
- class Throttling < Base
19
- # Rules around throttling settings
20
- class Contract < Contracts::Base
21
- configure do |config|
22
- config.error_messages = YAML.safe_load(
23
- File.read(
24
- File.join(Karafka.gem_root, 'config', 'locales', 'pro_errors.yml')
25
- )
26
- ).fetch('en').fetch('validations').fetch('topic')
27
- end
28
-
29
- nested(:throttling) do
30
- required(:active) { |val| [true, false].include?(val) }
31
- required(:interval) { |val| val.is_a?(Integer) && val.positive? }
32
- required(:limit) do |val|
33
- (val.is_a?(Integer) || val == Float::INFINITY) && val.positive?
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This Karafka component is a Pro component under a commercial license.
4
- # This Karafka component is NOT licensed under LGPL.
5
- #
6
- # All of the commercial components are present in the lib/karafka/pro directory of this
7
- # repository and their usage requires commercial license agreement.
8
- #
9
- # Karafka has also commercial-friendly license, commercial support and commercial components.
10
- #
11
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
12
- # your code to Maciej Mensfeld.
13
-
14
- module Karafka
15
- module Pro
16
- module Routing
17
- module Features
18
- class VirtualPartitions < Base
19
- # Rules around virtual partitions
20
- class Contract < Contracts::Base
21
- configure do |config|
22
- config.error_messages = YAML.safe_load(
23
- File.read(
24
- File.join(Karafka.gem_root, 'config', 'locales', 'pro_errors.yml')
25
- )
26
- ).fetch('en').fetch('validations').fetch('topic')
27
- end
28
-
29
- nested(:virtual_partitions) do
30
- required(:active) { |val| [true, false].include?(val) }
31
- required(:partitioner) { |val| val.nil? || val.respond_to?(:call) }
32
- required(:max_partitions) { |val| val.is_a?(Integer) && val >= 1 }
33
- end
34
-
35
- # When virtual partitions are defined, partitioner needs to respond to `#call` and it
36
- # cannot be nil
37
- virtual do |data, errors|
38
- next unless errors.empty?
39
-
40
- virtual_partitions = data[:virtual_partitions]
41
-
42
- next unless virtual_partitions[:active]
43
- next if virtual_partitions[:partitioner].respond_to?(:call)
44
-
45
- [[%i[virtual_partitions partitioner], :respond_to_call]]
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
52
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Karafka
4
- module Routing
5
- module Features
6
- class ActiveJob < Base
7
- # Rules around using ActiveJob routing - basically you need to have ActiveJob available
8
- # in order to be able to use active job routing
9
- class Contract < Contracts::Base
10
- configure do |config|
11
- config.error_messages = YAML.safe_load(
12
- File.read(
13
- File.join(Karafka.gem_root, 'config', 'locales', 'errors.yml')
14
- )
15
- ).fetch('en').fetch('validations').fetch('topic')
16
- end
17
-
18
- virtual do |data, errors|
19
- next unless errors.empty?
20
- next unless data[:active_job][:active]
21
- # One should not define active job jobs without ActiveJob being available for usage
22
- next if Object.const_defined?('ActiveJob::Base')
23
-
24
- [[%i[consumer], :active_job_missing]]
25
- end
26
-
27
- # ActiveJob needs to always run with manual offset management
28
- # Automatic offset management cannot work with ActiveJob. Otherwise we could mark as
29
- # consumed jobs that did not run because of shutdown.
30
- virtual do |data, errors|
31
- next unless errors.empty?
32
- next unless data[:active_job][:active]
33
- next if data[:manual_offset_management][:active]
34
-
35
- [[%i[manual_offset_management], :must_be_enabled]]
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Karafka
4
- module Routing
5
- module Features
6
- class DeadLetterQueue < Base
7
- # Rules around dead letter queue settings
8
- class Contract < Contracts::Base
9
- configure do |config|
10
- config.error_messages = YAML.safe_load(
11
- File.read(
12
- File.join(Karafka.gem_root, 'config', 'locales', 'errors.yml')
13
- )
14
- ).fetch('en').fetch('validations').fetch('topic')
15
- end
16
-
17
- nested :dead_letter_queue do
18
- required(:active) { |val| [true, false].include?(val) }
19
- required(:max_retries) { |val| val.is_a?(Integer) && val >= 0 }
20
- end
21
-
22
- # Validate topic name only if dlq is active
23
- virtual do |data, errors|
24
- next unless errors.empty?
25
-
26
- dead_letter_queue = data[:dead_letter_queue]
27
-
28
- next unless dead_letter_queue[:active]
29
-
30
- topic = dead_letter_queue[:topic]
31
-
32
- # When topic is set to false, it means we just want to skip dispatch on DLQ
33
- next if topic == false
34
- next if topic.is_a?(String) && Contracts::TOPIC_REGEXP.match?(topic)
35
-
36
- [[%i[dead_letter_queue topic], :format]]
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Karafka
4
- module Routing
5
- module Features
6
- class Declaratives < Base
7
- # Basic validation of the Kafka expected config details
8
- class Contract < Contracts::Base
9
- configure do |config|
10
- config.error_messages = YAML.safe_load(
11
- File.read(
12
- File.join(Karafka.gem_root, 'config', 'locales', 'errors.yml')
13
- )
14
- ).fetch('en').fetch('validations').fetch('topic')
15
- end
16
-
17
- nested :declaratives do
18
- required(:active) { |val| [true, false].include?(val) }
19
- required(:partitions) { |val| val.is_a?(Integer) && val.positive? }
20
- required(:replication_factor) { |val| val.is_a?(Integer) && val.positive? }
21
- required(:details) do |val|
22
- val.is_a?(Hash) &&
23
- val.keys.all? { |key| key.is_a?(Symbol) }
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Karafka
4
- module Routing
5
- module Features
6
- class ManualOffsetManagement < Base
7
- # Rules around manual offset management settings
8
- class Contract < Contracts::Base
9
- configure do |config|
10
- config.error_messages = YAML.safe_load(
11
- File.read(
12
- File.join(Karafka.gem_root, 'config', 'locales', 'errors.yml')
13
- )
14
- ).fetch('en').fetch('validations').fetch('topic')
15
- end
16
-
17
- nested :manual_offset_management do
18
- required(:active) { |val| [true, false].include?(val) }
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end