karafka 2.0.0.beta2 → 2.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +20 -0
  4. data/Gemfile.lock +4 -4
  5. data/bin/integrations +36 -14
  6. data/bin/scenario +29 -0
  7. data/docker-compose.yml +2 -0
  8. data/karafka.gemspec +1 -1
  9. data/lib/karafka/active_job/routing/extensions.rb +11 -1
  10. data/lib/karafka/base_consumer.rb +41 -26
  11. data/lib/karafka/connection/client.rb +38 -15
  12. data/lib/karafka/connection/listener.rb +17 -13
  13. data/lib/karafka/contracts/config.rb +2 -1
  14. data/lib/karafka/instrumentation/logger_listener.rb +37 -10
  15. data/lib/karafka/instrumentation/monitor.rb +3 -0
  16. data/lib/karafka/licenser.rb +26 -7
  17. data/lib/karafka/pro/active_job/consumer.rb +36 -9
  18. data/lib/karafka/pro/active_job/dispatcher.rb +9 -9
  19. data/lib/karafka/pro/active_job/job_options_contract.rb +9 -9
  20. data/lib/karafka/pro/base_consumer_extensions.rb +66 -0
  21. data/lib/karafka/pro/loader.rb +29 -15
  22. data/lib/karafka/pro/performance_tracker.rb +9 -9
  23. data/lib/karafka/pro/processing/jobs/consume_non_blocking.rb +9 -10
  24. data/lib/karafka/pro/processing/jobs_builder.rb +31 -0
  25. data/lib/karafka/pro/routing/extensions.rb +32 -0
  26. data/lib/karafka/pro/scheduler.rb +9 -9
  27. data/lib/karafka/processing/executor.rb +8 -1
  28. data/lib/karafka/processing/jobs_builder.rb +28 -0
  29. data/lib/karafka/processing/worker.rb +17 -9
  30. data/lib/karafka/routing/subscription_group.rb +1 -1
  31. data/lib/karafka/setup/config.rb +3 -1
  32. data/lib/karafka/status.rb +1 -3
  33. data/lib/karafka/version.rb +1 -1
  34. data.tar.gz.sig +0 -0
  35. metadata +8 -2
  36. metadata.gz.sig +0 -0
@@ -33,6 +33,8 @@ module Karafka
33
33
 
34
34
  return if license_config.expires_on > Date.today
35
35
 
36
+ raise_expired_license_token_in_dev(license_config.expires_on)
37
+
36
38
  notify_if_license_expired(license_config.expires_on)
37
39
  end
38
40
 
@@ -53,24 +55,41 @@ module Karafka
53
55
  )
54
56
  end
55
57
 
58
+ # Raises an error for test and dev environments if running pro with expired license
59
+ # We never want to cause any non-dev problems and we should never crash anything else than
60
+ # tests and development envs.
61
+ #
62
+ # @param expires_on [Date] when the license expires
63
+ def raise_expired_license_token_in_dev(expires_on)
64
+ env = Karafka::App.env
65
+
66
+ return unless env.development? || env.test?
67
+
68
+ raise Errors::ExpiredLicenseTokenError.new, expired_message(expires_on)
69
+ end
70
+
56
71
  # We do not raise an error here as we don't want to cause any problems to someone that runs
57
72
  # Karafka on production. Error message is enough.
58
73
  #
59
74
  # @param expires_on [Date] when the license expires
60
75
  def notify_if_license_expired(expires_on)
61
- message = <<~MSG.tr("\n", ' ')
62
- Your license expired on #{expires_on}.
63
- Please reach us at contact@karafka.io or visit https://karafka.io to obtain a valid one.
64
- MSG
65
-
66
- Karafka.logger.error(message)
76
+ Karafka.logger.error(expired_message(expires_on))
67
77
 
68
78
  Karafka.monitor.instrument(
69
79
  'error.occurred',
70
80
  caller: self,
71
- error: Errors::ExpiredLicenseTokenError.new(message),
81
+ error: Errors::ExpiredLicenseTokenError.new(expired_message(expires_on)),
72
82
  type: 'licenser.expired'
73
83
  )
74
84
  end
85
+
86
+ # @param expires_on [Date] when the license expires
87
+ # @return [String] expired message
88
+ def expired_message(expires_on)
89
+ <<~MSG.tr("\n", ' ')
90
+ Your license expired on #{expires_on}.
91
+ Please reach us at contact@karafka.io or visit https://karafka.io to obtain a valid one.
92
+ MSG
93
+ end
75
94
  end
76
95
  end
@@ -1,20 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
14
  module ActiveJob
6
- # This Karafka component is a Pro component.
7
- # All of the commercial components are present in the lib/karafka/pro directory of this
8
- # repository and their usage requires commercial license agreement.
9
- #
10
- # Karafka has also commercial-friendly license, commercial support and commercial components.
11
- #
12
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright
13
- # of your code to Maciej Mensfeld.
14
-
15
15
  # Pro ActiveJob consumer that is suppose to handle long-running jobs as well as short
16
16
  # running jobs
17
+ #
18
+ # When in LRJ, it will pause a given partition forever and will resume its processing only
19
+ # when all the jobs are done processing.
20
+ #
21
+ # It contains slightly better revocation warranties than the regular blocking consumer as
22
+ # it can stop processing batch of jobs in the middle after the revocation.
17
23
  class Consumer < Karafka::ActiveJob::Consumer
24
+ # Runs ActiveJob jobs processing and handles lrj if needed
25
+ def consume
26
+ messages.each do |message|
27
+ # If for any reason we've lost this partition, not worth iterating over new messages
28
+ # as they are no longer ours
29
+ return if revoked?
30
+ break if Karafka::App.stopping?
31
+
32
+ ::ActiveJob::Base.execute(
33
+ ::ActiveSupport::JSON.decode(message.raw_payload)
34
+ )
35
+
36
+ # We check it twice as the job may be long running
37
+ return if revoked?
38
+
39
+ mark_as_consumed(message)
40
+
41
+ # Do not process more if we are shutting down
42
+ break if Karafka::App.stopping?
43
+ end
44
+ end
18
45
  end
19
46
  end
20
47
  end
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
14
  # Karafka Pro ActiveJob components
6
15
  module ActiveJob
7
- # This Karafka component is a Pro component.
8
- # All of the commercial components are present in the lib/karafka/pro directory of this
9
- # repository and their usage requires commercial license agreement.
10
- #
11
- # Karafka has also commercial-friendly license, commercial support and commercial components.
12
- #
13
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright
14
- # of your code to Maciej Mensfeld.
15
-
16
16
  # Pro dispatcher that sends the ActiveJob job to a proper topic based on the queue name
17
17
  # and that allows to inject additional options into the producer, effectively allowing for a
18
18
  # much better and more granular control over the dispatch and consumption process.
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
14
  module ActiveJob
6
- # This Karafka component is a Pro component.
7
- # All of the commercial components are present in the lib/karafka/pro directory of this
8
- # repository and their usage requires commercial license agreement.
9
- #
10
- # Karafka has also commercial-friendly license, commercial support and commercial components.
11
- #
12
- # By sending a pull request to the pro components, you are agreeing to transfer the copyright
13
- # of your code to Maciej Mensfeld.
14
-
15
15
  # Contract for validating the options that can be altered with `#karafka_options` per job
16
16
  # class that works with Pro features.
17
17
  class JobOptionsContract < ::Karafka::ActiveJob::JobOptionsContract
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
12
+ module Karafka
13
+ module Pro
14
+ # Extensions to the base consumer that make it more pro and fancy
15
+ #
16
+ # @note In case of using lrj, manual pausing may not be the best idea as resume needs to happen
17
+ # after each batch is processed.
18
+ #
19
+ # They need to be added to the consumer via `#prepend`
20
+ module BaseConsumerExtensions
21
+ # Pause for tops 31 years
22
+ MAX_PAUSE_TIME = 1_000_000_000_000
23
+
24
+ private_constant :MAX_PAUSE_TIME
25
+
26
+ # Pauses processing of a given partition until we're done with the processing
27
+ # This ensures, that we can easily poll not reaching the `max.poll.interval`
28
+ def on_prepare
29
+ # Pause at the first message in a batch. That way in case of a crash, we will not loose
30
+ # any messages
31
+ pause(messages.first.offset, MAX_PAUSE_TIME) if topic.long_running_job?
32
+
33
+ super
34
+ end
35
+
36
+ # After user code, we seek and un-pause our partition
37
+ def on_consume
38
+ # If anything went wrong here, we should not run any partition management as it's Karafka
39
+ # core that will handle the backoff
40
+ return unless super
41
+
42
+ return unless topic.long_running_job?
43
+
44
+ # Nothing to resume if it was revoked
45
+ return if revoked?
46
+
47
+ # Once processing is done, we move to the new offset based on commits
48
+ seek(@seek_offset || messages.first.offset)
49
+ resume
50
+ end
51
+
52
+ # Marks this consumer revoked state as true
53
+ # This allows us for things like lrj to finish early as this state may change during lrj
54
+ # execution
55
+ def on_revoked
56
+ @revoked = true
57
+ super
58
+ end
59
+
60
+ # @return [Boolean] true if partition was revoked from the current consumer
61
+ def revoked?
62
+ @revoked || false
63
+ end
64
+ end
65
+ end
66
+ end
@@ -1,35 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
- # This Karafka component is a Pro component.
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
12
- # of your code to Maciej Mensfeld.
13
-
14
14
  # Loader requires and loads all the pro components only when they are needed
15
15
  class Loader
16
+ # All the pro components that need to be loaded
17
+ COMPONENTS = %w[
18
+ performance_tracker
19
+ scheduler
20
+ base_consumer_extensions
21
+ processing/jobs/consume_non_blocking
22
+ processing/jobs_builder
23
+ routing/extensions
24
+ active_job/consumer
25
+ active_job/dispatcher
26
+ active_job/job_options_contract
27
+ ].freeze
28
+
29
+ private_constant :COMPONENTS
30
+
16
31
  class << self
17
32
  # Loads all the pro components and configures them wherever it is expected
18
33
  # @param config [Dry::Configurable::Config] whole app config that we can alter with pro
19
34
  # components
20
35
  def setup(config)
21
- require_relative 'performance_tracker'
22
- require_relative 'scheduler'
23
- require_relative 'processing/jobs/consume_non_blocking'
24
- require_relative 'active_job/consumer'
25
- require_relative 'active_job/dispatcher'
26
- require_relative 'active_job/job_options_contract'
36
+ COMPONENTS.each { |component| require_relative(component) }
27
37
 
28
38
  config.internal.scheduler = Scheduler.new
39
+ config.internal.jobs_builder = Processing::JobsBuilder.new
29
40
  config.internal.active_job.consumer = ActiveJob::Consumer
30
41
  config.internal.active_job.dispatcher = ActiveJob::Dispatcher.new
31
42
  config.internal.active_job.job_options_contract = ActiveJob::JobOptionsContract.new
32
43
 
44
+ ::Karafka::Routing::Topic.include(Routing::Extensions)
45
+ ::Karafka::BaseConsumer.prepend(BaseConsumerExtensions)
46
+
33
47
  config.monitor.subscribe(PerformanceTracker.instance)
34
48
  end
35
49
  end
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
- # This Karafka component is a Pro component.
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
12
- # of your code to Maciej Mensfeld.
13
-
14
14
  # Tracker used to keep track of performance metrics
15
15
  # It provides insights that can be used to optimize processing flow
16
16
  class PerformanceTracker
@@ -1,21 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
14
  # Pro components related to processing part of Karafka
6
15
  module Processing
7
16
  # Pro jobs
8
17
  module Jobs
9
- # This Karafka component is a Pro component.
10
- # All of the commercial components are present in the lib/karafka/pro directory of this
11
- # repository and their usage requires commercial license agreement.
12
- #
13
- # Karafka has also commercial-friendly license, commercial support and commercial
14
- # components.
15
- #
16
- # By sending a pull request to the pro components, you are agreeing to transfer the
17
- # copyright of your code to Maciej Mensfeld.
18
-
19
18
  # The main job type in a non-blocking variant.
20
19
  # This variant works "like" the regular consumption but pauses the partition for as long
21
20
  # as it is needed until a job is done.
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
12
+ module Karafka
13
+ module Pro
14
+ module Processing
15
+ # Pro jobs builder that supports lrj
16
+ class JobsBuilder < ::Karafka::Processing::JobsBuilder
17
+ # @param executor [Karafka::Processing::Executor]
18
+ # @param messages [Karafka::Messages::Messages] messages batch to be consumed
19
+ # @return [Karafka::Processing::Jobs::Consume] blocking job
20
+ # @return [Karafka::Pro::Processing::Jobs::ConsumeNonBlocking] non blocking for lrj
21
+ def consume(executor, messages)
22
+ if executor.topic.long_running_job?
23
+ Jobs::ConsumeNonBlocking.new(executor, messages)
24
+ else
25
+ super
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
12
+ module Karafka
13
+ module Pro
14
+ # Pro routing components
15
+ module Routing
16
+ # Routing extensions that allow to configure some extra PRO routing options
17
+ module Extensions
18
+ class << self
19
+ # @param base [Class] class we extend
20
+ def included(base)
21
+ base.attr_accessor :long_running_job
22
+ end
23
+ end
24
+
25
+ # @return [Boolean] is a given job on a topic a long running one
26
+ def long_running_job?
27
+ @long_running_job || false
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # This Karafka component is a Pro component.
4
+ # All of the commercial components are present in the lib/karafka/pro directory of this
5
+ # repository and their usage requires commercial license agreement.
6
+ #
7
+ # Karafka has also commercial-friendly license, commercial support and commercial components.
8
+ #
9
+ # By sending a pull request to the pro components, you are agreeing to transfer the copyright of
10
+ # your code to Maciej Mensfeld.
11
+
3
12
  module Karafka
4
13
  module Pro
5
- # This Karafka component is a Pro component.
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
12
- # of your code to Maciej Mensfeld.
13
-
14
14
  # Optimizes scheduler that takes into consideration of execution time needed to process
15
15
  # messages from given topics partitions. It uses the non-preemptive LJF algorithm
16
16
  #
@@ -18,8 +18,15 @@ module Karafka
18
18
  # @return [String] subscription group id to which a given executor belongs
19
19
  attr_reader :group_id
20
20
 
21
+ # @return [Karafka::Messages::Messages] messages batch
21
22
  attr_reader :messages
22
23
 
24
+ # Topic accessibility may be needed for the jobs builder to be able to build a proper job
25
+ # based on the topic settings defined by the end user
26
+ #
27
+ # @return [Karafka::Routing::Topic] topic of this executor
28
+ attr_reader :topic
29
+
23
30
  # @param group_id [String] id of the subscription group to which the executor belongs
24
31
  # @param client [Karafka::Connection::Client] kafka client
25
32
  # @param topic [Karafka::Routing::Topic] topic for which this executor will run
@@ -52,7 +59,7 @@ module Karafka
52
59
  received_at
53
60
  )
54
61
 
55
- consumer.on_prepared
62
+ consumer.on_prepare
56
63
  end
57
64
 
58
65
  # Runs consumer data processing against given batch and handles failures and errors.
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ module Processing
5
+ # Class responsible for deciding what type of job should we build to run a given command and
6
+ # for building a proper job for it.
7
+ class JobsBuilder
8
+ # @param executor [Karafka::Processing::Executor]
9
+ # @param messages [Karafka::Messages::Messages] messages batch to be consumed
10
+ # @return [Karafka::Processing::Jobs::Consume] consumption job
11
+ def consume(executor, messages)
12
+ Jobs::Consume.new(executor, messages)
13
+ end
14
+
15
+ # @param executor [Karafka::Processing::Executor]
16
+ # @return [Karafka::Processing::Jobs::Revoked] revocation job
17
+ def revoked(executor)
18
+ Jobs::Revoked.new(executor)
19
+ end
20
+
21
+ # @param executor [Karafka::Processing::Executor]
22
+ # @return [Karafka::Processing::Jobs::Shutdown] shutdown job
23
+ def shutdown(executor)
24
+ Jobs::Shutdown.new(executor)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -19,9 +19,13 @@ module Karafka
19
19
  class Worker
20
20
  include Helpers::Async
21
21
 
22
+ # @return [String] id of this worker
23
+ attr_reader :id
24
+
22
25
  # @param jobs_queue [JobsQueue]
23
26
  # @return [Worker]
24
27
  def initialize(jobs_queue)
28
+ @id = SecureRandom.uuid
25
29
  @jobs_queue = jobs_queue
26
30
  end
27
31
 
@@ -43,19 +47,23 @@ module Karafka
43
47
  job = @jobs_queue.pop
44
48
 
45
49
  if job
46
- job.prepare
50
+ Karafka.monitor.instrument('worker.process', caller: self, job: job)
51
+
52
+ Karafka.monitor.instrument('worker.processed', caller: self, job: job) do
53
+ job.prepare
47
54
 
48
- # If a job is marked as non blocking, we can run a tick in the job queue and if there
49
- # are no other blocking factors, the job queue will be unlocked.
50
- # If this does not run, all the things will be blocking and job queue won't allow to
51
- # pass it until done.
52
- @jobs_queue.tick(job.group_id) if job.non_blocking?
55
+ # If a job is marked as non blocking, we can run a tick in the job queue and if there
56
+ # are no other blocking factors, the job queue will be unlocked.
57
+ # If this does not run, all the things will be blocking and job queue won't allow to
58
+ # pass it until done.
59
+ @jobs_queue.tick(job.group_id) if job.non_blocking?
53
60
 
54
- job.call
61
+ job.call
55
62
 
56
- job.teardown
63
+ job.teardown
57
64
 
58
- true
65
+ true
66
+ end
59
67
  else
60
68
  false
61
69
  end
@@ -44,7 +44,7 @@ module Karafka
44
44
  kafka[:'auto.offset.reset'] ||= @topics.first.initial_offset
45
45
  # Karafka manages the offsets based on the processing state, thus we do not rely on the
46
46
  # rdkafka offset auto-storing
47
- kafka[:'enable.auto.offset.store'] = 'false'
47
+ kafka[:'enable.auto.offset.store'] = false
48
48
  kafka.freeze
49
49
  kafka
50
50
  end
@@ -83,7 +83,7 @@ module Karafka
83
83
  # @see https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md
84
84
  setting :kafka, default: {}
85
85
 
86
- # Namespace for internal settings that should not be modified
86
+ # Namespace for internal settings that should not be modified directly
87
87
  setting :internal do
88
88
  # option routing_builder [Karafka::Routing::Builder] builder instance
89
89
  setting :routing_builder, default: Routing::Builder.new
@@ -98,6 +98,8 @@ module Karafka
98
98
  setting :subscription_groups_builder, default: Routing::SubscriptionGroupsBuilder.new
99
99
  # option scheduler [Class] scheduler we will be using
100
100
  setting :scheduler, default: Scheduler.new
101
+ # option jobs_builder [Class] jobs builder we want to use
102
+ setting :jobs_builder, default: Processing::JobsBuilder.new
101
103
 
102
104
  # Karafka components for ActiveJob
103
105
  setting :active_job do
@@ -31,9 +31,7 @@ module Karafka
31
31
  # We skip as during this state we do not have yet a monitor
32
32
  return if initializing?
33
33
 
34
- # Trap context disallows to run certain things that we instrument
35
- # so the state changes are executed from a separate thread
36
- Thread.new { Karafka.monitor.instrument("app.#{state}") }.join
34
+ Karafka.monitor.instrument("app.#{state}")
37
35
  end
38
36
  end
39
37
  end
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.0.beta2'
6
+ VERSION = '2.0.0.beta3'
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.0.beta2
4
+ version: 2.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -34,7 +34,7 @@ cert_chain:
34
34
  R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
35
35
  pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
36
36
  -----END CERTIFICATE-----
37
- date: 2022-06-07 00:00:00.000000000 Z
37
+ date: 2022-06-14 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: dry-configurable
@@ -171,6 +171,7 @@ files:
171
171
  - bin/create_token
172
172
  - bin/integrations
173
173
  - bin/karafka
174
+ - bin/scenario
174
175
  - bin/stress
175
176
  - certs/karafka-pro.pem
176
177
  - certs/mensfeld.pem
@@ -231,9 +232,12 @@ files:
231
232
  - lib/karafka/pro/active_job/consumer.rb
232
233
  - lib/karafka/pro/active_job/dispatcher.rb
233
234
  - lib/karafka/pro/active_job/job_options_contract.rb
235
+ - lib/karafka/pro/base_consumer_extensions.rb
234
236
  - lib/karafka/pro/loader.rb
235
237
  - lib/karafka/pro/performance_tracker.rb
236
238
  - lib/karafka/pro/processing/jobs/consume_non_blocking.rb
239
+ - lib/karafka/pro/processing/jobs_builder.rb
240
+ - lib/karafka/pro/routing/extensions.rb
237
241
  - lib/karafka/pro/scheduler.rb
238
242
  - lib/karafka/process.rb
239
243
  - lib/karafka/processing/executor.rb
@@ -242,6 +246,7 @@ files:
242
246
  - lib/karafka/processing/jobs/consume.rb
243
247
  - lib/karafka/processing/jobs/revoked.rb
244
248
  - lib/karafka/processing/jobs/shutdown.rb
249
+ - lib/karafka/processing/jobs_builder.rb
245
250
  - lib/karafka/processing/jobs_queue.rb
246
251
  - lib/karafka/processing/worker.rb
247
252
  - lib/karafka/processing/workers_batch.rb
@@ -273,6 +278,7 @@ files:
273
278
  homepage: https://karafka.io
274
279
  licenses:
275
280
  - LGPL-3.0
281
+ - Commercial
276
282
  metadata:
277
283
  source_code_uri: https://github.com/karafka/karafka
278
284
  rubygems_mfa_required: 'true'
metadata.gz.sig CHANGED
Binary file