karafka 2.0.28 → 2.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c69f25e46161a6f20e57262b4eb67a852b2345e4cea05b4919bca43105fa2ca2
4
- data.tar.gz: fb065461afccd8d2416bd509dfa6f04b47df07dd6b6ffcbcde9d266f35b71412
3
+ metadata.gz: 3a258a78f3df80b4cda4f315f56ef4f7fb48003f63d0d58140c189b01b3f4875
4
+ data.tar.gz: c267cb96bb8a972a2255f4a1298adde63678be4502b4ec8573af9c8a940435b4
5
5
  SHA512:
6
- metadata.gz: 1819faf0d836a42cc6d05adde4cc896a31ec58d3b0de19f4f62d224fd16d1b3ebaa816afc45fc67025de579ac63c81cc09e18ffa4dacb8e2f05f636b21df24b5
7
- data.tar.gz: 65437e05a791e8e0f86a17d08ab331ca52dfdadbb3979109b2358b6ba700ca63e6e956d0125784da0228adabf2aa92d18058f7f3440e72ec98b3659c9b127ba1
6
+ metadata.gz: beed9b0cbc83249d0bf227edb859142888d748dab6a972bf58c2d7e38ad578292544948bd9f2f25edbeebe6b37d1f0d20d47fc5e15d3d12420964447d414c54a
7
+ data.tar.gz: 7da728f75e5540d339887d2fb3bee4787016bdcd16a56f29b4f9c0b3e9f4ff45f1d6f0e843d25bf3e7a31e05ea3a320e174a005a149f76156618dc70327e71de
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 2.0.29 (2023-01-30)
4
+ - [Improvement] Make sure, that the `Karafka#producer` instance has the `LoggerListener` enabled in the install template, so Karafka by default prints both consumer and producer info.
5
+ - [Improvement] Extract the code loading capabilities of Karafka console from the executable, so web can use it to provide CLI commands.
6
+ - [Fix] Fix for: running karafka console results in NameError with Rails (#1280)
7
+ - [Fix] Make sure, that the `caller` for async errors is being published.
8
+ - [Change] Make sure that WaterDrop `2.4.10` or higher is used with this release to support Web-UI.
9
+
3
10
  ## 2.0.28 (2023-01-25)
4
11
  - **[Feature]** Provide the ability to use Dead Letter Queue with Virtual Partitions.
5
- - [Improvement] Collapse Virtual Partitions upon retryable error to a single partition. This allows dead letter queue to operate and mitigate issues arising from work virtualization. This removes uncertainties upon errors that can be retried and processed. Affects given topic partition virtualization only for multi-topic and mulit-partition parallelization. It also minimizes potential "flickering" where given data set has potentially many corrupted messages. The collapse will last until all the messages from the collective corrupted batch are processed. After that, virtualization will resume.
12
+ - [Improvement] Collapse Virtual Partitions upon retryable error to a single partition. This allows dead letter queue to operate and mitigate issues arising from work virtualization. This removes uncertainties upon errors that can be retried and processed. Affects given topic partition virtualization only for multi-topic and multi-partition parallelization. It also minimizes potential "flickering" where given data set has potentially many corrupted messages. The collapse will last until all the messages from the collective corrupted batch are processed. After that, virtualization will resume.
6
13
  - [Improvement] Introduce `#collapsed?` consumer method available for consumers using Virtual Partitions.
7
14
  - [Improvement] Allow for customization of DLQ dispatched message details in Pro (#1266) via the `#enhance_dlq_message` consumer method.
8
15
  - [Improvement] Include `original_consumer_group` in the DLQ dispatched messages in Pro.
data/Gemfile.lock CHANGED
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (2.0.28)
4
+ karafka (2.0.29)
5
5
  karafka-core (>= 2.0.9, < 3.0.0)
6
6
  thor (>= 0.20)
7
- waterdrop (>= 2.4.9, < 3.0.0)
7
+ waterdrop (>= 2.4.10, < 3.0.0)
8
8
  zeitwerk (~> 2.3)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activejob (7.0.4.1)
14
- activesupport (= 7.0.4.1)
13
+ activejob (7.0.4.2)
14
+ activesupport (= 7.0.4.2)
15
15
  globalid (>= 0.3.6)
16
- activesupport (7.0.4.1)
16
+ activesupport (7.0.4.2)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
20
20
  tzinfo (~> 2.0)
21
21
  byebug (11.1.3)
22
- concurrent-ruby (1.1.10)
22
+ concurrent-ruby (1.2.0)
23
23
  diff-lcs (1.5.0)
24
24
  docile (1.4.0)
25
25
  factory_bot (6.2.1)
@@ -61,12 +61,13 @@ GEM
61
61
  thor (1.2.1)
62
62
  tzinfo (2.0.5)
63
63
  concurrent-ruby (~> 1.0)
64
- waterdrop (2.4.9)
64
+ waterdrop (2.4.10)
65
65
  karafka-core (>= 2.0.9, < 3.0.0)
66
66
  zeitwerk (~> 2.3)
67
67
  zeitwerk (2.6.6)
68
68
 
69
69
  PLATFORMS
70
+ arm64-darwin-21
70
71
  x86_64-linux
71
72
 
72
73
  DEPENDENCIES
@@ -78,4 +79,4 @@ DEPENDENCIES
78
79
  simplecov
79
80
 
80
81
  BUNDLED WITH
81
- 2.4.2
82
+ 2.4.5
data/README.md CHANGED
@@ -58,7 +58,8 @@ We also maintain many [integration specs](https://github.com/karafka/karafka/tre
58
58
  1. Add and install Karafka:
59
59
 
60
60
  ```bash
61
- bundle add karafka
61
+ # Make sure to install Karafka 2.0
62
+ bundle add karafka --version ">= 2.0.28"
62
63
 
63
64
  bundle exec karafka install
64
65
  ```
@@ -86,7 +87,7 @@ I also sell Karafka Pro subscriptions. It includes a commercial-friendly license
86
87
 
87
88
  **20%** of the income will be distributed back to other OSS projects that Karafka uses under the hood.
88
89
 
89
- Help me provide high-quality open-source software. Please see the Karafka [homepage](https://karafka.io) for more details.
90
+ Help me provide high-quality open-source software. Please see the Karafka [homepage](https://karafka.io/#become-pro) for more details.
90
91
 
91
92
  ## Support
92
93
 
data/bin/karafka CHANGED
@@ -6,24 +6,6 @@ require 'karafka'
6
6
  # our bin/karafka cli
7
7
  ENV['KARAFKA_CLI'] = 'true'
8
8
 
9
- # If there is a boot file, we need to require it as we expect it to contain
10
- # Karafka app setup, routes, etc
11
- if File.exist?(Karafka.boot_file)
12
- rails_env_rb = File.join(Dir.pwd, 'config/environment.rb')
13
-
14
- # Load Rails environment file that starts Rails, so we can reference consumers and other things
15
- # from `karafka.rb` file. This will work only for Rails, for non-rails a manual setup is needed
16
- require rails_env_rb if Kernel.const_defined?(:Rails) && File.exist?(rails_env_rb)
17
-
18
- require Karafka.boot_file.to_s
19
- else
20
- # However when it is unavailable, we still want to be able to run help command
21
- # and install command as they don't require configured app itself to run
22
- raise(
23
- Karafka::Errors::MissingBootFileError,
24
- Karafka.boot_file
25
- ) unless %w[-h install].include?(ARGV[0])
26
- end
27
-
9
+ Karafka::Cli::Base.load
28
10
  Karafka::Cli.prepare
29
11
  Karafka::Cli.start
@@ -11,6 +11,8 @@ set -e
11
11
  if [ "$MODE" != "after" ]; then
12
12
  # Check the remote license prior to bundle installing
13
13
  curl \
14
+ --retry 5 \
15
+ --retry-delay 1 \
14
16
  --fail \
15
17
  -u $KARAFKA_PRO_USERNAME:$KARAFKA_PRO_PASSWORD \
16
18
  https://gems.karafka.io/gems/karafka-license-$KARAFKA_PRO_VERSION.gem \
data/karafka.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'karafka-core', '>= 2.0.9', '< 3.0.0'
25
25
  spec.add_dependency 'thor', '>= 0.20'
26
- spec.add_dependency 'waterdrop', '>= 2.4.9', '< 3.0.0'
26
+ spec.add_dependency 'waterdrop', '>= 2.4.10', '< 3.0.0'
27
27
  spec.add_dependency 'zeitwerk', '~> 2.3'
28
28
 
29
29
  if $PROGRAM_NAME.end_with?('gem')
@@ -34,6 +34,26 @@ module Karafka
34
34
  end
35
35
 
36
36
  class << self
37
+ # Loads proper environment with what is needed to run the CLI
38
+ def load
39
+ # If there is a boot file, we need to require it as we expect it to contain
40
+ # Karafka app setup, routes, etc
41
+ if File.exist?(::Karafka.boot_file)
42
+ rails_env_rb = File.join(Dir.pwd, 'config/environment.rb')
43
+
44
+ # Load Rails environment file that starts Rails, so we can reference consumers and
45
+ # other things from `karafka.rb` file. This will work only for Rails, for non-rails
46
+ # a manual setup is needed
47
+ require rails_env_rb if Kernel.const_defined?(:Rails) && File.exist?(rails_env_rb)
48
+
49
+ require Karafka.boot_file.to_s
50
+ # However when it is unavailable, we still want to be able to run help command
51
+ # and install command as they don't require configured app itself to run
52
+ elsif %w[-h install].none? { |cmd| cmd == ARGV[0] }
53
+ raise ::Karafka::Errors::MissingBootFileError, ::Karafka.boot_file
54
+ end
55
+ end
56
+
37
57
  # Allows to set options for Thor cli
38
58
  # @see https://github.com/erikhuda/thor
39
59
  # @param option Single option details
@@ -9,22 +9,27 @@ module Karafka
9
9
  option aliases: 'c'
10
10
 
11
11
  class << self
12
- # @return [String] Console executing command
12
+ # @return [String] Console executing command for non-Rails setup
13
13
  # @example
14
14
  # Karafka::Cli::Console.command #=> 'KARAFKA_CONSOLE=true bundle exec irb...'
15
- def command
16
- envs = [
17
- "IRBRC='#{Karafka.gem_root}/.console_irbrc'",
18
- 'KARAFKA_CONSOLE=true'
19
- ]
20
- "#{envs.join(' ')} bundle exec irb -r #{Karafka.boot_file}"
15
+ def console
16
+ "IRBRC='#{Karafka.gem_root}/.console_irbrc' bundle exec irb -r #{Karafka.boot_file}"
17
+ end
18
+
19
+ # @return [String] Console executing command for Rails setup
20
+ # @note In case of Rails, it has its own console, hence we can just defer to it
21
+ def rails_console
22
+ 'bundle exec rails console'
21
23
  end
22
24
  end
23
25
 
24
26
  # Start the Karafka console
25
27
  def call
26
28
  cli.info
27
- exec self.class.command
29
+
30
+ command = ::Karafka.rails? ? self.class.rails_console : self.class.console
31
+
32
+ exec "KARAFKA_CONSOLE=true #{command}"
28
33
  end
29
34
  end
30
35
  end
@@ -28,6 +28,7 @@ module Karafka
28
28
 
29
29
  @monitor.instrument(
30
30
  'error.occurred',
31
+ caller: self,
31
32
  subscription_group_id: @subscription_group_id,
32
33
  consumer_group_id: @consumer_group_id,
33
34
  type: 'librdkafka.error',
@@ -2,14 +2,7 @@
2
2
 
3
3
  # This file contains Railtie for auto-configuration
4
4
 
5
- rails = false
6
-
7
- begin
8
- # Do not load Rails again if already loaded
9
- Object.const_defined?('Rails::Railtie') || require('rails')
10
-
11
- rails = true
12
- rescue LoadError
5
+ unless Karafka.rails?
13
6
  # Without defining this in any way, Zeitwerk ain't happy so we do it that way
14
7
  module Karafka
15
8
  class Railtie
@@ -17,7 +10,7 @@ rescue LoadError
17
10
  end
18
11
  end
19
12
 
20
- if rails
13
+ if Karafka.rails?
21
14
  # Load ActiveJob adapter
22
15
  require 'active_job/karafka'
23
16
 
@@ -40,6 +40,12 @@ class KarafkaApp < Karafka::App
40
40
  Karafka.monitor.subscribe(Karafka::Instrumentation::LoggerListener.new)
41
41
  # Karafka.monitor.subscribe(Karafka::Instrumentation::ProctitleListener.new)
42
42
 
43
+ # This logger prints the producer development info using the Karafka logger.
44
+ # It is similar to the consumer logger listener but producer oriented.
45
+ Karafka.producer.monitor.subscribe(
46
+ WaterDrop::Instrumentation::LoggerListener.new(Karafka.logger)
47
+ )
48
+
43
49
  routes.draw do
44
50
  <% if rails? -%>
45
51
  # Uncomment this if you use Karafka with ActiveJob
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.28'
6
+ VERSION = '2.0.29'
7
7
  end
data/lib/karafka.rb CHANGED
@@ -70,6 +70,19 @@ module Karafka
70
70
  App.config.license.token != false
71
71
  end
72
72
 
73
+ # @return [Boolean] Do we run within/with Rails. We use this to initialize Railtie and proxy
74
+ # the console invocation to Rails
75
+ def rails?
76
+ return @rails if instance_variable_defined?('@rails')
77
+
78
+ # Do not load Rails again if already loaded
79
+ Object.const_defined?('Rails::Railtie') || require('rails')
80
+
81
+ @rails = true
82
+ rescue LoadError
83
+ @rails = false
84
+ end
85
+
73
86
  # @return [String] path to a default file that contains booting procedure etc
74
87
  # @note By default it is a file called 'karafka.rb' but it can be specified as you wish if you
75
88
  # have Karafka that is merged into a Sinatra/Rails app and karafka.rb is taken.
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.28
4
+ version: 2.0.29
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-01-25 00:00:00.000000000 Z
38
+ date: 2023-01-30 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
@@ -77,7 +77,7 @@ dependencies:
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 2.4.9
80
+ version: 2.4.10
81
81
  - - "<"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 3.0.0
@@ -87,7 +87,7 @@ dependencies:
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 2.4.9
90
+ version: 2.4.10
91
91
  - - "<"
92
92
  - !ruby/object:Gem::Version
93
93
  version: 3.0.0
metadata.gz.sig CHANGED
Binary file