karafka 2.0.0.alpha2 → 2.0.0.alpha3
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/.github/workflows/ci.yml +2 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/bin/integrations +42 -6
- data/lib/karafka/cli/install.rb +1 -0
- data/lib/karafka/instrumentation/monitor.rb +1 -0
- data/lib/karafka/railtie.rb +48 -22
- data/lib/karafka/setup/config.rb +2 -0
- data/lib/karafka/status.rb +1 -0
- data/lib/karafka/templates/karafka.rb.erb +1 -1
- data/lib/karafka/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -4
- metadata.gz.sig +0 -0
- data/.github/FUNDING.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e715fa7f45c40a200fc2d281d765f5d42ac4f03ba6e3f529b86a0adc90bc1af
|
4
|
+
data.tar.gz: 50e2083063f1fd77ffc529395550e443c4166aa035c2d87716390059bec6fe32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d225ba3d118716bcf1265e06d3d781aee7a3e9e87edaab791fdf1b240dc1565a0a460a3f99ca5b8687f6e63701ff2fee3d8ffe343dc18c5e1bfdde4af9deb852
|
7
|
+
data.tar.gz: 73084d0b5f3678f37b63debdcf944517e0f954bf0a21242caae3c807ced721afd26f5d6bdb864bcf5fe36bb2d098ca3dd167901a1c3ddc61b0ceb00f8a3a2d96
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -113,6 +113,7 @@ jobs:
|
|
113
113
|
- name: Install latest Bundler
|
114
114
|
run: |
|
115
115
|
gem install bundler --no-document
|
116
|
+
gem update --system --no-document
|
116
117
|
bundle config set without 'tools benchmarks docs'
|
117
118
|
|
118
119
|
- name: Bundle install
|
@@ -124,4 +125,4 @@ jobs:
|
|
124
125
|
env:
|
125
126
|
KARAFKA_PRO_LICENSE_TOKEN: ${{ secrets.KARAFKA_PRO_LICENSE_TOKEN }}
|
126
127
|
GITHUB_COVERAGE: ${{matrix.coverage}}
|
127
|
-
run:
|
128
|
+
run: bin/integrations
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# Karafka framework changelog
|
2
2
|
|
3
|
+
## 2.0.0-alpha3 (2022-03-16)
|
4
|
+
- Restore 'app.initialized' state and add notification on it
|
5
|
+
- Fix the installation flow for Rails and add integration tests for this scenario
|
6
|
+
- Add more integration tests covering some edge cases
|
7
|
+
|
3
8
|
## 2.0.0-alpha2 (2022-02-19)
|
4
9
|
- Require `kafka` keys to be symbols
|
10
|
+
- Added ActiveJob Pro adapter
|
11
|
+
- Small updates to the license and docs
|
5
12
|
|
6
13
|
## 2.0.0-alpha1 (2022-01-30)
|
7
14
|
- Change license to `LGPL-3.0`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka (2.0.0.
|
4
|
+
karafka (2.0.0.alpha3)
|
5
5
|
dry-configurable (~> 0.13)
|
6
6
|
dry-monitor (~> 0.5)
|
7
7
|
dry-validation (~> 1.7)
|
@@ -71,7 +71,7 @@ GEM
|
|
71
71
|
activesupport (>= 5.0)
|
72
72
|
i18n (1.10.0)
|
73
73
|
concurrent-ruby (~> 1.0)
|
74
|
-
mini_portile2 (2.
|
74
|
+
mini_portile2 (2.8.0)
|
75
75
|
minitest (5.15.0)
|
76
76
|
rake (13.0.6)
|
77
77
|
rdkafka (0.11.1)
|
data/bin/integrations
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
# Runner to run integration specs in parallel
|
4
4
|
|
5
|
+
# Part of integration specs run pristine without bundler.
|
6
|
+
# If we would run bundle exec when running this code, bundler would inject its own context
|
7
|
+
# into them, messing things up heavily
|
8
|
+
raise 'This code needs to be executed WITHOUT bundle exec' if Kernel.const_defined?(:Bundler)
|
9
|
+
|
5
10
|
require 'open3'
|
6
11
|
require 'fileutils'
|
7
12
|
require 'pathname'
|
13
|
+
require 'tmpdir'
|
8
14
|
|
9
15
|
ROOT_PATH = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '../')))
|
10
16
|
|
@@ -38,9 +44,7 @@ class Scenario
|
|
38
44
|
# @param path [String] path to the scenarios file
|
39
45
|
def initialize(path)
|
40
46
|
@path = path
|
41
|
-
@stdin, @stdout, @stderr, @wait_thr = Open3.popen3(
|
42
|
-
"bundle exec ruby -r ./spec/integrations_helper.rb #{path}"
|
43
|
-
)
|
47
|
+
@stdin, @stdout, @stderr, @wait_thr = Open3.popen3(init_and_build_cmd)
|
44
48
|
@started_at = current_time
|
45
49
|
# Last 1024 characters from stdout
|
46
50
|
@stdout_tail = ''
|
@@ -102,6 +106,35 @@ class Scenario
|
|
102
106
|
|
103
107
|
private
|
104
108
|
|
109
|
+
# Sets up a proper environment for a given spec to run and returns the run command
|
110
|
+
# @return [String] run command
|
111
|
+
def init_and_build_cmd
|
112
|
+
scenario_dir = File.dirname(@path)
|
113
|
+
|
114
|
+
# If there is a Gemfile in a scenario directory, it means it is a pristine spec and we need
|
115
|
+
# to run bundle install, etc in order to run it
|
116
|
+
if File.exist?(File.join(scenario_dir, 'Gemfile'))
|
117
|
+
# We copy the spec into a temp dir, not to pollute the spec location with logs, etc
|
118
|
+
temp_dir = Dir.mktmpdir
|
119
|
+
file_name = File.basename(@path)
|
120
|
+
|
121
|
+
FileUtils.cp_r("#{scenario_dir}/.", temp_dir)
|
122
|
+
|
123
|
+
<<~CMD
|
124
|
+
cd #{temp_dir} &&
|
125
|
+
KARAFKA_GEM_DIR=#{ROOT_PATH} \
|
126
|
+
BUNDLE_AUTO_INSTALL=true \
|
127
|
+
PRISTINE_MODE=true \
|
128
|
+
bundle exec ruby -r #{ROOT_PATH}/spec/integrations_helper.rb #{file_name}
|
129
|
+
CMD
|
130
|
+
else
|
131
|
+
<<~CMD
|
132
|
+
KARAFKA_GEM_DIR=#{ROOT_PATH} \
|
133
|
+
bundle exec ruby -r ./spec/integrations_helper.rb #{@path}
|
134
|
+
CMD
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
105
138
|
# @return [Float] current machine time
|
106
139
|
def current_time
|
107
140
|
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
@@ -136,10 +169,13 @@ end
|
|
136
169
|
# Load all the specs
|
137
170
|
specs = Dir[ROOT_PATH.join('spec/integrations/**/*.rb')]
|
138
171
|
|
139
|
-
# If
|
140
|
-
|
172
|
+
# If filters is provided, apply
|
173
|
+
# Allows to provide several filters one after another and applies all of them
|
174
|
+
ARGV.each do |filter|
|
175
|
+
specs.delete_if { |name| !name.include?(filter) }
|
176
|
+
end
|
141
177
|
|
142
|
-
raise ArgumentError, "No integration specs with
|
178
|
+
raise ArgumentError, "No integration specs with filters: #{ARGV.join(', ')}" if specs.empty?
|
143
179
|
|
144
180
|
# Randomize order
|
145
181
|
seed = (ENV['SEED'] || rand(0..10_000)).to_i
|
data/lib/karafka/cli/install.rb
CHANGED
data/lib/karafka/railtie.rb
CHANGED
@@ -38,36 +38,62 @@ if rails
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
# This lines will make Karafka print to stdout like puma or unicorn when we run karafka
|
42
|
+
# server + will support code reloading with each fetched loop. We do it only for karafka
|
43
|
+
# based commands as Rails processes and console will have it enabled already
|
44
|
+
initializer 'karafka.configure_rails_logger' do
|
45
45
|
# Make Karafka use Rails logger
|
46
46
|
::Karafka::App.config.logger = Rails.logger
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
ActiveSupport::Logger.
|
54
|
-
ActiveSupport::Logger.new($stdout)
|
55
|
-
)
|
48
|
+
next unless Rails.env.development?
|
49
|
+
next unless ENV.key?('KARAFKA_CLI')
|
50
|
+
|
51
|
+
Rails.logger.extend(
|
52
|
+
ActiveSupport::Logger.broadcast(
|
53
|
+
ActiveSupport::Logger.new($stdout)
|
56
54
|
)
|
55
|
+
)
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
next unless Rails.application.reloaders.any?(&:updated?)
|
58
|
+
initializer 'karafka.configure_rails_auto_load_paths' do |app|
|
59
|
+
# Consumers should autoload by default in the Rails app so they are visible
|
60
|
+
app.config.autoload_paths += %w[app/consumers]
|
61
|
+
end
|
63
62
|
|
64
|
-
|
65
|
-
|
63
|
+
initializer 'karafka.configure_rails_code_reloader' do
|
64
|
+
# There are components that won't work with older Rails version, so we check it and
|
65
|
+
# provide a failover
|
66
|
+
rails6plus = Rails.gem_version >= Gem::Version.new('6.0.0')
|
67
|
+
|
68
|
+
next unless Rails.env.development?
|
69
|
+
next unless ENV.key?('KARAFKA_CLI')
|
70
|
+
next unless rails6plus
|
71
|
+
|
72
|
+
# We can have many listeners, but it does not matter in which we will reload the code
|
73
|
+
# as long as all the consumers will be re-created as Rails reload is thread-safe
|
74
|
+
::Karafka::App.monitor.subscribe('connection.listener.fetch_loop') do
|
75
|
+
# Reload code each time there is a change in the code
|
76
|
+
next unless Rails.application.reloaders.any?(&:updated?)
|
77
|
+
|
78
|
+
Rails.application.reloader.reload!
|
66
79
|
end
|
80
|
+
end
|
67
81
|
|
68
|
-
|
69
|
-
|
70
|
-
|
82
|
+
initializer 'karafka.require_karafka_boot_file' do |app|
|
83
|
+
rails6plus = Rails.gem_version >= Gem::Version.new('6.0.0')
|
84
|
+
|
85
|
+
karafka_boot_file = Rails.root.join(Karafka.boot_file.to_s).to_s
|
86
|
+
|
87
|
+
if rails6plus
|
88
|
+
app.reloader.to_prepare do
|
89
|
+
# Load Karafka boot file, so it can be used in Rails server context
|
90
|
+
require karafka_boot_file
|
91
|
+
end
|
92
|
+
else
|
93
|
+
# Load Karafka main setup for older Rails versions
|
94
|
+
app.config.after_initialize do
|
95
|
+
require karafka_boot_file
|
96
|
+
end
|
71
97
|
end
|
72
98
|
end
|
73
99
|
end
|
data/lib/karafka/setup/config.rb
CHANGED
data/lib/karafka/status.rb
CHANGED
@@ -27,7 +27,7 @@ APP_LOADER.eager_load
|
|
27
27
|
|
28
28
|
class KarafkaApp < Karafka::App
|
29
29
|
setup do |config|
|
30
|
-
config.kafka = { 'bootstrap.servers'
|
30
|
+
config.kafka = { 'bootstrap.servers': '127.0.0.1:9092' }
|
31
31
|
config.client_id = 'example_app'
|
32
32
|
<% if rails? -%>
|
33
33
|
# Recreate consumers with each batch. This will allow Rails code reload to work in the
|
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.0.
|
4
|
+
version: 2.0.0.alpha3
|
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-
|
37
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: dry-configurable
|
@@ -151,7 +151,6 @@ files:
|
|
151
151
|
- ".coditsu/ci.yml"
|
152
152
|
- ".console_irbrc"
|
153
153
|
- ".diffend.yml"
|
154
|
-
- ".github/FUNDING.yml"
|
155
154
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
156
155
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
157
156
|
- ".github/workflows/ci.yml"
|
@@ -283,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
282
|
- !ruby/object:Gem::Version
|
284
283
|
version: 1.3.1
|
285
284
|
requirements: []
|
286
|
-
rubygems_version: 3.3.
|
285
|
+
rubygems_version: 3.3.4
|
287
286
|
signing_key:
|
288
287
|
specification_version: 4
|
289
288
|
summary: Ruby based framework for working with Apache Kafka
|
metadata.gz.sig
CHANGED
Binary file
|
data/.github/FUNDING.yml
DELETED