karafka 2.0.41 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +2 -2
  4. data/CHANGELOG.md +36 -1
  5. data/Gemfile.lock +17 -17
  6. data/README.md +2 -2
  7. data/config/locales/errors.yml +10 -0
  8. data/config/locales/pro_errors.yml +0 -2
  9. data/docker-compose.yml +2 -2
  10. data/karafka.gemspec +2 -2
  11. data/lib/karafka/active_job/consumer.rb +16 -11
  12. data/lib/karafka/active_job/current_attributes/loading.rb +36 -0
  13. data/lib/karafka/active_job/current_attributes/persistence.rb +28 -0
  14. data/lib/karafka/active_job/current_attributes.rb +42 -0
  15. data/lib/karafka/active_job/dispatcher.rb +8 -2
  16. data/lib/karafka/base_consumer.rb +1 -1
  17. data/lib/karafka/connection/client.rb +3 -1
  18. data/lib/karafka/errors.rb +3 -0
  19. data/lib/karafka/instrumentation/vendors/kubernetes/liveness_listener.rb +176 -0
  20. data/lib/karafka/messages/batch_metadata.rb +9 -2
  21. data/lib/karafka/pro/active_job/consumer.rb +1 -10
  22. data/lib/karafka/pro/active_job/dispatcher.rb +2 -2
  23. data/lib/karafka/pro/processing/coordinator.rb +20 -1
  24. data/lib/karafka/pro/processing/filters/virtual_limiter.rb +52 -0
  25. data/lib/karafka/pro/processing/filters_applier.rb +4 -0
  26. data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_mom_vp.rb +1 -1
  27. data/lib/karafka/pro/processing/strategies/aj/dlq_lrj_mom.rb +3 -1
  28. data/lib/karafka/pro/processing/strategies/aj/dlq_mom_vp.rb +2 -2
  29. data/lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb +2 -0
  30. data/lib/karafka/pro/processing/strategies/aj/mom_vp.rb +1 -1
  31. data/lib/karafka/pro/processing/strategies/dlq/ftr.rb +1 -1
  32. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_mom.rb +3 -6
  33. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_mom_vp.rb +43 -0
  34. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_vp.rb +1 -0
  35. data/lib/karafka/pro/processing/strategies/dlq/ftr_mom.rb +3 -7
  36. data/lib/karafka/pro/processing/strategies/dlq/ftr_mom_vp.rb +41 -0
  37. data/lib/karafka/pro/processing/strategies/dlq/ftr_vp.rb +1 -0
  38. data/lib/karafka/pro/processing/strategies/dlq/lrj_mom.rb +3 -6
  39. data/lib/karafka/pro/processing/strategies/dlq/lrj_mom_vp.rb +36 -0
  40. data/lib/karafka/pro/processing/strategies/dlq/lrj_vp.rb +1 -0
  41. data/lib/karafka/pro/processing/strategies/dlq/mom.rb +8 -7
  42. data/lib/karafka/pro/processing/strategies/dlq/mom_vp.rb +37 -0
  43. data/lib/karafka/pro/processing/strategies/lrj/default.rb +2 -0
  44. data/lib/karafka/pro/processing/strategies/lrj/ftr_mom_vp.rb +40 -0
  45. data/lib/karafka/pro/processing/strategies/lrj/mom.rb +2 -0
  46. data/lib/karafka/pro/processing/strategies/lrj/mom_vp.rb +38 -0
  47. data/lib/karafka/pro/processing/strategies/mom/ftr_vp.rb +37 -0
  48. data/lib/karafka/pro/{base_consumer.rb → processing/strategies/mom/vp.rb} +17 -7
  49. data/lib/karafka/pro/processing/strategies/vp/default.rb +51 -0
  50. data/lib/karafka/pro/processing/virtual_offset_manager.rb +147 -0
  51. data/lib/karafka/pro/routing/features/virtual_partitions/contract.rb +0 -17
  52. data/lib/karafka/processing/strategies/default.rb +2 -0
  53. data/lib/karafka/processing/strategies/dlq_mom.rb +9 -7
  54. data/lib/karafka/version.rb +1 -1
  55. data/lib/karafka.rb +5 -0
  56. data.tar.gz.sig +0 -0
  57. metadata +20 -8
  58. metadata.gz.sig +0 -0
  59. data/lib/karafka/instrumentation/vendors/datadog/listener.rb +0 -16
@@ -35,18 +35,9 @@ module Karafka
35
35
  # double-processing
36
36
  break if Karafka::App.stopping? && !topic.virtual_partitions?
37
37
 
38
- # Break if we already know, that one of virtual partitions has failed and we will
39
- # be restarting processing all together after all VPs are done. This will minimize
40
- # number of jobs that will be re-processed
41
- break if topic.virtual_partitions? && failing?
42
-
43
38
  consume_job(message)
44
39
 
45
- # We cannot mark jobs as done after each if there are virtual partitions. Otherwise
46
- # this could create random markings.
47
- # The exception here is the collapsed state where we can move one after another
48
- next if topic.virtual_partitions? && !collapsed?
49
-
40
+ # We can always mark because of the virtual offset management that we have in VPs
50
41
  mark_as_consumed(message)
51
42
  end
52
43
  end
@@ -39,7 +39,7 @@ module Karafka
39
39
  fetch_option(job, :dispatch_method, DEFAULTS),
40
40
  dispatch_details(job).merge!(
41
41
  topic: job.queue_name,
42
- payload: ::ActiveSupport::JSON.encode(job.serialize)
42
+ payload: ::ActiveSupport::JSON.encode(serialize_job(job))
43
43
  )
44
44
  )
45
45
  end
@@ -54,7 +54,7 @@ module Karafka
54
54
 
55
55
  dispatches[d_method] << dispatch_details(job).merge!(
56
56
  topic: job.queue_name,
57
- payload: ::ActiveSupport::JSON.encode(job.serialize)
57
+ payload: ::ActiveSupport::JSON.encode(serialize_job(job))
58
58
  )
59
59
  end
60
60
 
@@ -17,7 +17,7 @@ module Karafka
17
17
  # Pro coordinator that provides extra orchestration methods useful for parallel processing
18
18
  # within the same partition
19
19
  class Coordinator < ::Karafka::Processing::Coordinator
20
- attr_reader :filter
20
+ attr_reader :filter, :virtual_offset_manager
21
21
 
22
22
  # @param args [Object] anything the base coordinator accepts
23
23
  def initialize(*args)
@@ -27,6 +27,20 @@ module Karafka
27
27
  @flow_lock = Mutex.new
28
28
  @collapser = Collapser.new
29
29
  @filter = FiltersApplier.new(self)
30
+
31
+ return unless topic.virtual_partitions?
32
+
33
+ @virtual_offset_manager = VirtualOffsetManager.new(
34
+ topic.name,
35
+ partition
36
+ )
37
+
38
+ # We register our own "internal" filter to support filtering of messages that were marked
39
+ # as consumed virtually
40
+ @filter.filters << Filters::VirtualLimiter.new(
41
+ @virtual_offset_manager,
42
+ @collapser
43
+ )
30
44
  end
31
45
 
32
46
  # Starts the coordination process
@@ -40,6 +54,11 @@ module Karafka
40
54
  @filter.apply!(messages)
41
55
 
42
56
  @executed.clear
57
+
58
+ # We keep the old processed offsets until the collapsing is done and regular processing
59
+ # with virtualization is restored
60
+ @virtual_offset_manager.clear if topic.virtual_partitions? && !@collapser.collapsed?
61
+
43
62
  @last_message = messages.last
44
63
  end
45
64
 
@@ -0,0 +1,52 @@
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 Processing
17
+ module Filters
18
+ # Removes messages that are already marked as consumed in the virtual offset manager
19
+ # This should operate only when using virtual partitions.
20
+ #
21
+ # This cleaner prevents us from duplicated processing of messages that were virtually
22
+ # marked as consumed even if we could not mark them as consumed in Kafka. This allows us
23
+ # to limit reprocessing when errors occur drastically when operating with virtual
24
+ # partitions
25
+ #
26
+ # @note It should be registered only when VPs are used
27
+ class VirtualLimiter < Base
28
+ # @param manager [Processing::VirtualOffsetManager]
29
+ # @param collapser [Processing::Collapser]
30
+ def initialize(manager, collapser)
31
+ @manager = manager
32
+ @collapser = collapser
33
+
34
+ super()
35
+ end
36
+
37
+ # Remove messages that we already marked as virtually consumed. Does nothing if not in
38
+ # the collapsed mode.
39
+ #
40
+ # @param messages [Array<Karafka::Messages::Message>]
41
+ def apply!(messages)
42
+ return unless @collapser.collapsed?
43
+
44
+ marked = @manager.marked
45
+
46
+ messages.delete_if { |message| marked.include?(message.offset) }
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -21,6 +21,10 @@ module Karafka
21
21
  # This means that this is the API we expose as a single filter, allowing us to control
22
22
  # the filtering via many filters easily.
23
23
  class FiltersApplier
24
+ # @return [Array] registered filters array. Useful if we want to inject internal context
25
+ # aware filters.
26
+ attr_reader :filters
27
+
24
28
  # @param coordinator [Pro::Coordinator] pro coordinator
25
29
  def initialize(coordinator)
26
30
  # Builds filters out of their factories
@@ -22,7 +22,7 @@ module Karafka
22
22
  # - Mom
23
23
  # - VP
24
24
  module DlqFtrMomVp
25
- include Strategies::Vp::Default
25
+ include Strategies::Aj::DlqMomVp
26
26
  include Strategies::Aj::DlqFtrMom
27
27
 
28
28
  # Features for this strategy
@@ -24,7 +24,9 @@ module Karafka
24
24
  # This case is a bit of special. Please see the `AjDlqMom` for explanation on how the
25
25
  # offset management works in this case.
26
26
  module DlqLrjMom
27
- include Strategies::Aj::DlqLrjMomVp
27
+ include Strategies::Default
28
+ include Strategies::Dlq::Default
29
+ include Strategies::Aj::LrjMom
28
30
 
29
31
  # Features for this strategy
30
32
  FEATURES = %i[
@@ -20,9 +20,9 @@ module Karafka
20
20
  # Manual offset management enabled
21
21
  # Virtual Partitions enabled
22
22
  module DlqMomVp
23
- include Strategies::Dlq::Default
24
- include Strategies::Vp::Default
25
23
  include Strategies::Default
24
+ include Strategies::Dlq::Vp
25
+ include Strategies::Vp::Default
26
26
 
27
27
  # Features for this strategy
28
28
  FEATURES = %i[
@@ -34,6 +34,8 @@ module Karafka
34
34
 
35
35
  # No actions needed for the standard flow here
36
36
  def handle_before_enqueue
37
+ super
38
+
37
39
  coordinator.on_enqueued do
38
40
  pause(coordinator.seek_offset, Strategies::Lrj::Default::MAX_PAUSE_TIME, false)
39
41
  end
@@ -20,8 +20,8 @@ module Karafka
20
20
  # Manual offset management enabled
21
21
  # Virtual Partitions enabled
22
22
  module MomVp
23
- include Strategies::Vp::Default
24
23
  include Strategies::Default
24
+ include Strategies::Vp::Default
25
25
 
26
26
  # Features for this strategy
27
27
  FEATURES = %i[
@@ -20,7 +20,7 @@ module Karafka
20
20
  # - Ftr
21
21
  module Ftr
22
22
  include Strategies::Ftr::Default
23
- include Strategies::Dlq::Vp
23
+ include Strategies::Dlq::Default
24
24
 
25
25
  # Features for this strategy
26
26
  FEATURES = %i[
@@ -55,14 +55,11 @@ module Karafka
55
55
 
56
56
  return resume if revoked?
57
57
 
58
- skippable_message, marked = find_skippable_message
58
+ skippable_message, _marked = find_skippable_message
59
59
  dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
60
60
 
61
- if marked
62
- pause(coordinator.seek_offset, nil, false)
63
- else
64
- pause(skippable_message.offset + 1, nil, false)
65
- end
61
+ coordinator.seek_offset = skippable_message.offset + 1
62
+ pause(coordinator.seek_offset, nil, false)
66
63
  end
67
64
  end
68
65
  end
@@ -0,0 +1,43 @@
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 Processing
17
+ module Strategies
18
+ module Dlq
19
+ # DLQ enabled
20
+ # Ftr enabled
21
+ # LRJ enabled
22
+ # MoM enabled
23
+ # VP enabled
24
+ module FtrLrjMomVp
25
+ include Strategies::Vp::Default
26
+ include Strategies::Dlq::Vp
27
+ # Same as non VP because of the coordinator post-execution lock
28
+ include Strategies::Dlq::FtrLrjMom
29
+
30
+ # Features for this strategy
31
+ FEATURES = %i[
32
+ dead_letter_queue
33
+ filtering
34
+ long_running_job
35
+ manual_offset_management
36
+ virtual_partitions
37
+ ].freeze
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -22,6 +22,7 @@ module Karafka
22
22
  # Virtual Partitions
23
23
  module FtrLrjVp
24
24
  include Strategies::Vp::Default
25
+ include Strategies::Dlq::Vp
25
26
  # Same as non VP because of the coordinator post-execution lock
26
27
  include Strategies::Dlq::FtrLrj
27
28
 
@@ -53,15 +53,11 @@ module Karafka
53
53
  # We reset the pause to indicate we will now consider it as "ok".
54
54
  coordinator.pause_tracker.reset
55
55
 
56
- skippable_message, marked = find_skippable_message
56
+ skippable_message, _marked = find_skippable_message
57
57
  dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
58
58
 
59
- # Move beyond the broken message
60
- if marked
61
- pause(coordinator.seek_offset, nil, false)
62
- else
63
- pause(skippable_message.offset + 1, nil, false)
64
- end
59
+ coordinator.seek_offset = skippable_message.offset + 1
60
+ pause(coordinator.seek_offset, nil, false)
65
61
  end
66
62
  end
67
63
  end
@@ -0,0 +1,41 @@
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 Processing
17
+ module Strategies
18
+ module Dlq
19
+ # - DLQ
20
+ # - Ftr
21
+ # - Mom
22
+ # - VP
23
+ # We can use the `Strategies::FtrMom` because VPs collapse prior to DLQ
24
+ module FtrMomVp
25
+ include Strategies::Mom::Vp
26
+ include Strategies::Dlq::Vp
27
+ include Strategies::Dlq::FtrMom
28
+
29
+ # Features for this strategy
30
+ FEATURES = %i[
31
+ dead_letter_queue
32
+ filtering
33
+ manual_offset_management
34
+ virtual_partitions
35
+ ].freeze
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -23,6 +23,7 @@ module Karafka
23
23
  # Behaves same as non-VP due to coordinator lock
24
24
  module FtrVp
25
25
  include Strategies::Vp::Default
26
+ include Strategies::Dlq::Vp
26
27
  include Strategies::Dlq::Ftr
27
28
 
28
29
  # Features for this strategy
@@ -47,14 +47,11 @@ module Karafka
47
47
 
48
48
  return resume if revoked?
49
49
 
50
- skippable_message, marked = find_skippable_message
50
+ skippable_message, _marked = find_skippable_message
51
51
  dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
52
52
 
53
- if marked
54
- pause(coordinator.seek_offset, nil, false)
55
- else
56
- pause(skippable_message.offset + 1, nil, false)
57
- end
53
+ coordinator.seek_offset = skippable_message.offset + 1
54
+ pause(coordinator.seek_offset, nil, false)
58
55
  end
59
56
  end
60
57
  end
@@ -0,0 +1,36 @@
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 Processing
17
+ module Strategies
18
+ module Dlq
19
+ # Strategy for supporting DLQ with Mom, LRJ and VP enabled
20
+ module LrjMomVp
21
+ # Feature set for this strategy
22
+ FEATURES = %i[
23
+ dead_letter_queue
24
+ long_running_job
25
+ manual_offset_management
26
+ virtual_partitions
27
+ ].freeze
28
+
29
+ include Strategies::Dlq::Vp
30
+ include Strategies::Dlq::LrjMom
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -22,6 +22,7 @@ module Karafka
22
22
  module LrjVp
23
23
  # Same flow as the Dlq Lrj because VP collapses on errors, so DlqLrj can kick in
24
24
  include Strategies::Vp::Default
25
+ include Strategies::Dlq::Vp
25
26
  include Strategies::Dlq::Lrj
26
27
 
27
28
  # Features for this strategy
@@ -47,15 +47,16 @@ module Karafka
47
47
  # We reset the pause to indicate we will now consider it as "ok".
48
48
  coordinator.pause_tracker.reset
49
49
 
50
- skippable_message, marked = find_skippable_message
50
+ skippable_message, = find_skippable_message
51
51
  dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
52
52
 
53
- # Move beyond the broken message
54
- if marked
55
- pause(coordinator.seek_offset, nil, false)
56
- else
57
- pause(skippable_message.offset + 1, nil, false)
58
- end
53
+ # Save the next offset we want to go with after moving given message to DLQ
54
+ # Without this, we would not be able to move forward and we would end up
55
+ # in an infinite loop trying to un-pause from the message we've already processed
56
+ # Of course, since it's a MoM a rebalance or kill, will move it back as no
57
+ # offsets are being committed
58
+ coordinator.seek_offset = skippable_message.offset + 1
59
+ pause(coordinator.seek_offset, nil, false)
59
60
  end
60
61
  end
61
62
  end
@@ -0,0 +1,37 @@
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 Processing
17
+ module Strategies
18
+ module Dlq
19
+ # Dead-Letter Queue enabled
20
+ # MoM enabled
21
+ # Virtual Partitions enabled
22
+ module MomVp
23
+ include Strategies::Dlq::Vp
24
+ include Strategies::Dlq::Mom
25
+
26
+ # Features for this strategy
27
+ FEATURES = %i[
28
+ dead_letter_queue
29
+ manual_offset_management
30
+ virtual_partitions
31
+ ].freeze
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -30,6 +30,8 @@ module Karafka
30
30
 
31
31
  # We always need to pause prior to doing any jobs for LRJ
32
32
  def handle_before_enqueue
33
+ super
34
+
33
35
  # This ensures that when running LRJ with VP, things operate as expected run only
34
36
  # once for all the virtual partitions collectively
35
37
  coordinator.on_enqueued do
@@ -0,0 +1,40 @@
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 Processing
17
+ module Strategies
18
+ # Filtering related init strategies
19
+ module Lrj
20
+ # Filtering enabled
21
+ # LRJ enabled
22
+ # MoM enabled
23
+ # VPs enabled
24
+ module FtrMomVp
25
+ # Filtering + LRJ + Mom + VPs
26
+ FEATURES = %i[
27
+ filtering
28
+ long_running_job
29
+ manual_offset_management
30
+ virtual_partitions
31
+ ].freeze
32
+
33
+ include Strategies::Lrj::MomVp
34
+ include Strategies::Lrj::FtrMom
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -30,6 +30,8 @@ module Karafka
30
30
 
31
31
  # We always need to pause prior to doing any jobs for LRJ
32
32
  def handle_before_enqueue
33
+ super
34
+
33
35
  # This ensures that when running LRJ with VP, things operate as expected run only
34
36
  # once for all the virtual partitions collectively
35
37
  coordinator.on_enqueued do
@@ -0,0 +1,38 @@
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 Processing
17
+ module Strategies
18
+ # Namespace for all the LRJ starting strategies
19
+ module Lrj
20
+ # Long-Running Job enabled
21
+ # Manual offset management enabled
22
+ # Virtual Partitions enabled
23
+ module MomVp
24
+ include Strategies::Mom::Vp
25
+ include Strategies::Lrj::Mom
26
+
27
+ # Features for this strategy
28
+ FEATURES = %i[
29
+ long_running_job
30
+ manual_offset_management
31
+ virtual_partitions
32
+ ].freeze
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
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 Processing
17
+ module Strategies
18
+ module Mom
19
+ # - Mom enabled
20
+ # - Ftr enabled
21
+ # - Vp enabled
22
+ module FtrVp
23
+ include Strategies::Mom::Vp
24
+ include Strategies::Mom::Ftr
25
+
26
+ # Features of this strategy
27
+ FEATURES = %i[
28
+ filtering
29
+ manual_offset_management
30
+ virtual_partitions
31
+ ].freeze
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -13,13 +13,23 @@
13
13
 
14
14
  module Karafka
15
15
  module Pro
16
- # Karafka PRO consumer.
17
- #
18
- # If you use PRO, all your consumers should inherit (indirectly) from it.
19
- #
20
- # @note In case of using lrj, manual pausing may not be the best idea as resume needs to happen
21
- # after each batch is processed.
22
- class BaseConsumer < Karafka::BaseConsumer
16
+ module Processing
17
+ module Strategies
18
+ module Mom
19
+ # - Mom enabled
20
+ # - Vp enabled
21
+ module Vp
22
+ include Strategies::Vp::Default
23
+ include Strategies::Mom::Default
24
+
25
+ # Features of this strategy
26
+ FEATURES = %i[
27
+ manual_offset_management
28
+ virtual_partitions
29
+ ].freeze
30
+ end
31
+ end
32
+ end
23
33
  end
24
34
  end
25
35
  end