karafka 1.4.0 → 1.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +27 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +48 -1
- data/Gemfile.lock +78 -92
- data/README.md +27 -28
- data/certs/mensfeld.pem +21 -21
- data/config/errors.yml +2 -0
- data/karafka.gemspec +15 -12
- data/lib/karafka/assignment_strategies/round_robin.rb +13 -0
- data/lib/karafka/attributes_map.rb +1 -0
- data/lib/karafka/cli/base.rb +4 -4
- data/lib/karafka/cli/install.rb +3 -2
- data/lib/karafka/cli/missingno.rb +19 -0
- data/lib/karafka/cli/server.rb +8 -8
- data/lib/karafka/cli.rb +8 -0
- data/lib/karafka/connection/api_adapter.rb +15 -18
- data/lib/karafka/connection/builder.rb +6 -1
- data/lib/karafka/connection/client.rb +8 -5
- data/lib/karafka/contracts/consumer_group.rb +8 -3
- data/lib/karafka/contracts.rb +1 -1
- data/lib/karafka/helpers/class_matcher.rb +1 -1
- data/lib/karafka/instrumentation/logger.rb +6 -10
- data/lib/karafka/instrumentation/stdout_listener.rb +2 -2
- data/lib/karafka/routing/builder.rb +1 -0
- data/lib/karafka/routing/consumer_group.rb +5 -3
- data/lib/karafka/server.rb +1 -1
- data/lib/karafka/setup/config.rb +59 -53
- data/lib/karafka/templates/karafka.rb.erb +1 -1
- data/lib/karafka/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +47 -72
- 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: 8799d5854288a36f4af9e7688241a0df2719a7d982fe4940d9d7acec80ec8389
|
4
|
+
data.tar.gz: 7d17c4de581aa08467c8c810f8a2977a8e7cffa1f0f68f2ff369e39bc15f888b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f43dc6e07e61671aff52a9200333945e93b3641e63a44ff5d877456278553040f5ba2e6dbf69f30570d974bcaa6010312b66da5aee478f7d356b3268a62428a2
|
7
|
+
data.tar.gz: 87f1ed908bfc5f3076c42bec507c916900881e7536f23822d38fd8cd0214b0fdedb58a6d6920e8f11dd0e035c6ec301bfb217f906d129873b2b5a8df20d18e53
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
name: ci
|
2
2
|
|
3
|
+
concurrency: ci-${{ github.ref }}
|
4
|
+
|
3
5
|
on:
|
6
|
+
pull_request:
|
4
7
|
push:
|
5
8
|
schedule:
|
6
9
|
- cron: '0 1 * * *'
|
@@ -8,15 +11,16 @@ on:
|
|
8
11
|
jobs:
|
9
12
|
specs:
|
10
13
|
runs-on: ubuntu-latest
|
14
|
+
needs: diffend
|
11
15
|
strategy:
|
12
16
|
fail-fast: false
|
13
17
|
matrix:
|
14
18
|
ruby:
|
19
|
+
- '3.1'
|
20
|
+
- '3.0'
|
15
21
|
- '2.7'
|
16
|
-
- '2.6'
|
17
|
-
- '2.5'
|
18
22
|
include:
|
19
|
-
- ruby: '
|
23
|
+
- ruby: '3.1'
|
20
24
|
coverage: 'true'
|
21
25
|
steps:
|
22
26
|
- uses: actions/checkout@v2
|
@@ -40,6 +44,26 @@ jobs:
|
|
40
44
|
env:
|
41
45
|
GITHUB_COVERAGE: ${{matrix.coverage}}
|
42
46
|
run: bundle exec rspec
|
47
|
+
|
48
|
+
diffend:
|
49
|
+
runs-on: ubuntu-latest
|
50
|
+
strategy:
|
51
|
+
fail-fast: false
|
52
|
+
steps:
|
53
|
+
- uses: actions/checkout@v2
|
54
|
+
with:
|
55
|
+
fetch-depth: 0
|
56
|
+
- name: Set up Ruby
|
57
|
+
uses: ruby/setup-ruby@v1
|
58
|
+
with:
|
59
|
+
ruby-version: 3.1
|
60
|
+
- name: Install latest bundler
|
61
|
+
run: gem install bundler --no-document
|
62
|
+
- name: Install Diffend plugin
|
63
|
+
run: bundle plugin install diffend
|
64
|
+
- name: Bundle Secure
|
65
|
+
run: bundle secure
|
66
|
+
|
43
67
|
coditsu:
|
44
68
|
runs-on: ubuntu-latest
|
45
69
|
strategy:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.0
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,55 @@
|
|
1
1
|
# Karafka framework changelog
|
2
2
|
|
3
|
+
## 1.4.13 (2022-02-19)
|
4
|
+
- Drop support for ruby 2.6
|
5
|
+
- Add mfa requirement
|
6
|
+
|
7
|
+
## 1.4.12 (2022-01-13)
|
8
|
+
- Ruby 3.1 support
|
9
|
+
- `irb` dependency removal (vbyno)
|
10
|
+
|
11
|
+
## 1.4.11 (2021-12-04)
|
12
|
+
- Source code metadata url added to the gemspec
|
13
|
+
- Gem bump
|
14
|
+
|
15
|
+
## 1.4.10 (2021-10-30)
|
16
|
+
- update gems requirements in the gemspec (nijikon)
|
17
|
+
|
18
|
+
## 1.4.9 (2021-09-29)
|
19
|
+
- fix `dry-configurable` deprecation warnings for default value as positional argument
|
20
|
+
|
21
|
+
## 1.4.8 (2021-09-08)
|
22
|
+
- Allow 'rails' in Gemfile to enable rails-aware generator (rewritten)
|
23
|
+
|
24
|
+
## 1.4.7 (2021-09-04)
|
25
|
+
- Update ruby-kafka to `1.4.0`
|
26
|
+
- Support for `resolve_seed_brokers` option (with Azdaroth)
|
27
|
+
- Set minimum `ruby-kafka` requirement to `1.3.0`
|
28
|
+
|
29
|
+
## 1.4.6 (2021-08-05)
|
30
|
+
- #700 Fix Ruby 3 compatibility issues in Connection::Client#pause (MmKolodziej)
|
31
|
+
|
32
|
+
## 1.4.5 (2021-06-16)
|
33
|
+
- Fixup logger checks for non-writeable logfile (ojab)
|
34
|
+
- #689 - Update the stdout initialization message for framework initialization
|
35
|
+
|
36
|
+
## 1.4.4 (2021-04-19)
|
37
|
+
- Remove Ruby 2.5 support and update minimum Ruby requirement to 2.6
|
38
|
+
- Remove rake dependency
|
39
|
+
|
40
|
+
## 1.4.3 (2021-03-24)
|
41
|
+
- Fixes for Ruby 3.0 compatibility
|
42
|
+
|
43
|
+
## 1.4.2 (2021-02-16)
|
44
|
+
- Rescue Errno::EROFS in ensure_dir_exists (unasuke)
|
45
|
+
|
46
|
+
## 1.4.1 (2020-12-04)
|
47
|
+
- Return non-zero exit code when printing usage
|
48
|
+
- Add support for :assignment_strategy for consumers
|
49
|
+
|
3
50
|
## 1.4.0 (2020-09-05)
|
4
51
|
- Rename `Karafka::Params::Metadata` to `Karafka::Params::BatchMetadata`
|
5
|
-
|
52
|
+
- Rename consumer `#metadata` to `#batch_metadata`
|
6
53
|
- Separate metadata (including Karafka native metadata) from the root of params (backwards compatibility preserved thanks to rabotyaga)
|
7
54
|
- Remove metadata hash dependency
|
8
55
|
- Remove params dependency on a hash in favour of PORO
|
data/Gemfile.lock
CHANGED
@@ -1,132 +1,118 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka (1.4.
|
5
|
-
dry-configurable (~> 0.
|
6
|
-
dry-inflector (~> 0.
|
7
|
-
dry-monitor (~> 0.
|
8
|
-
dry-validation (~> 1.
|
4
|
+
karafka (1.4.13)
|
5
|
+
dry-configurable (~> 0.13)
|
6
|
+
dry-inflector (~> 0.2)
|
7
|
+
dry-monitor (~> 0.5)
|
8
|
+
dry-validation (~> 1.7)
|
9
9
|
envlogic (~> 1.1)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
waterdrop (~> 1.4.0)
|
15
|
-
zeitwerk (~> 2.1)
|
10
|
+
ruby-kafka (>= 1.3.0)
|
11
|
+
thor (>= 1.1)
|
12
|
+
waterdrop (~> 1.4)
|
13
|
+
zeitwerk (~> 2.4)
|
16
14
|
|
17
15
|
GEM
|
18
16
|
remote: https://rubygems.org/
|
19
17
|
specs:
|
20
|
-
activesupport (
|
18
|
+
activesupport (7.0.1)
|
21
19
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
-
i18n (>=
|
23
|
-
minitest (
|
24
|
-
tzinfo (~>
|
25
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
20
|
+
i18n (>= 1.6, < 2)
|
21
|
+
minitest (>= 5.1)
|
22
|
+
tzinfo (~> 2.0)
|
26
23
|
byebug (11.1.3)
|
27
|
-
concurrent-ruby (1.1.
|
28
|
-
delivery_boy (1.0
|
29
|
-
king_konf (~> 0
|
24
|
+
concurrent-ruby (1.1.9)
|
25
|
+
delivery_boy (1.1.0)
|
26
|
+
king_konf (~> 1.0)
|
30
27
|
ruby-kafka (~> 1.0)
|
31
|
-
diff-lcs (1.
|
32
|
-
digest-crc (0.6.
|
33
|
-
rake (
|
34
|
-
docile (1.
|
35
|
-
dry-configurable (0.
|
28
|
+
diff-lcs (1.5.0)
|
29
|
+
digest-crc (0.6.4)
|
30
|
+
rake (>= 12.0.0, < 14.0.0)
|
31
|
+
docile (1.4.0)
|
32
|
+
dry-configurable (0.14.0)
|
36
33
|
concurrent-ruby (~> 1.0)
|
37
|
-
dry-core (~> 0.
|
38
|
-
|
39
|
-
dry-container (0.7.2)
|
34
|
+
dry-core (~> 0.6)
|
35
|
+
dry-container (0.9.0)
|
40
36
|
concurrent-ruby (~> 1.0)
|
41
|
-
dry-configurable (~> 0.
|
42
|
-
dry-core (0.
|
37
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
38
|
+
dry-core (0.7.1)
|
43
39
|
concurrent-ruby (~> 1.0)
|
44
|
-
dry-
|
45
|
-
dry-events (0.2.0)
|
40
|
+
dry-events (0.3.0)
|
46
41
|
concurrent-ruby (~> 1.0)
|
47
|
-
dry-core (~> 0.
|
48
|
-
|
49
|
-
dry-
|
50
|
-
dry-
|
51
|
-
dry-logic (1.0.7)
|
42
|
+
dry-core (~> 0.5, >= 0.5)
|
43
|
+
dry-inflector (0.2.1)
|
44
|
+
dry-initializer (3.1.1)
|
45
|
+
dry-logic (1.2.0)
|
52
46
|
concurrent-ruby (~> 1.0)
|
53
|
-
dry-core (~> 0.
|
54
|
-
|
55
|
-
|
56
|
-
dry-
|
57
|
-
dry-core (~> 0.4)
|
58
|
-
dry-equalizer (~> 0.2)
|
47
|
+
dry-core (~> 0.5, >= 0.5)
|
48
|
+
dry-monitor (0.5.0)
|
49
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
50
|
+
dry-core (~> 0.5, >= 0.5)
|
59
51
|
dry-events (~> 0.2)
|
60
|
-
dry-schema (1.
|
52
|
+
dry-schema (1.9.1)
|
61
53
|
concurrent-ruby (~> 1.0)
|
62
|
-
dry-configurable (~> 0.
|
63
|
-
dry-core (~> 0.
|
64
|
-
dry-equalizer (~> 0.2)
|
54
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
55
|
+
dry-core (~> 0.5, >= 0.5)
|
65
56
|
dry-initializer (~> 3.0)
|
66
57
|
dry-logic (~> 1.0)
|
67
|
-
dry-types (~> 1.
|
68
|
-
dry-types (1.
|
58
|
+
dry-types (~> 1.5)
|
59
|
+
dry-types (1.5.1)
|
69
60
|
concurrent-ruby (~> 1.0)
|
70
61
|
dry-container (~> 0.3)
|
71
|
-
dry-core (~> 0.
|
72
|
-
dry-equalizer (~> 0.3)
|
62
|
+
dry-core (~> 0.5, >= 0.5)
|
73
63
|
dry-inflector (~> 0.1, >= 0.1.2)
|
74
64
|
dry-logic (~> 1.0, >= 1.0.2)
|
75
|
-
dry-validation (1.
|
65
|
+
dry-validation (1.8.0)
|
76
66
|
concurrent-ruby (~> 1.0)
|
77
67
|
dry-container (~> 0.7, >= 0.7.1)
|
78
|
-
dry-core (~> 0.
|
79
|
-
dry-equalizer (~> 0.2)
|
68
|
+
dry-core (~> 0.5, >= 0.5)
|
80
69
|
dry-initializer (~> 3.0)
|
81
|
-
dry-schema (~> 1.
|
82
|
-
envlogic (1.1.
|
70
|
+
dry-schema (~> 1.9, >= 1.9.1)
|
71
|
+
envlogic (1.1.4)
|
83
72
|
dry-inflector (~> 0.1)
|
84
|
-
factory_bot (6.
|
73
|
+
factory_bot (6.2.0)
|
85
74
|
activesupport (>= 5.0.0)
|
86
|
-
i18n (1.
|
75
|
+
i18n (1.9.1)
|
87
76
|
concurrent-ruby (~> 1.0)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
rspec-expectations (~> 3.9.0)
|
99
|
-
rspec-mocks (~> 3.9.0)
|
100
|
-
rspec-core (3.9.2)
|
101
|
-
rspec-support (~> 3.9.3)
|
102
|
-
rspec-expectations (3.9.2)
|
77
|
+
king_konf (1.0.0)
|
78
|
+
minitest (5.15.0)
|
79
|
+
rake (13.0.6)
|
80
|
+
rspec (3.10.0)
|
81
|
+
rspec-core (~> 3.10.0)
|
82
|
+
rspec-expectations (~> 3.10.0)
|
83
|
+
rspec-mocks (~> 3.10.0)
|
84
|
+
rspec-core (3.10.2)
|
85
|
+
rspec-support (~> 3.10.0)
|
86
|
+
rspec-expectations (3.10.2)
|
103
87
|
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
-
rspec-support (~> 3.
|
105
|
-
rspec-mocks (3.
|
88
|
+
rspec-support (~> 3.10.0)
|
89
|
+
rspec-mocks (3.10.3)
|
106
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
-
rspec-support (~> 3.
|
108
|
-
rspec-support (3.
|
109
|
-
ruby-kafka (1.
|
91
|
+
rspec-support (~> 3.10.0)
|
92
|
+
rspec-support (3.10.3)
|
93
|
+
ruby-kafka (1.4.0)
|
110
94
|
digest-crc
|
111
|
-
simplecov (0.
|
95
|
+
simplecov (0.21.2)
|
112
96
|
docile (~> 1.1)
|
113
97
|
simplecov-html (~> 0.11)
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
98
|
+
simplecov_json_formatter (~> 0.1)
|
99
|
+
simplecov-html (0.12.3)
|
100
|
+
simplecov_json_formatter (0.1.3)
|
101
|
+
thor (1.2.1)
|
102
|
+
tzinfo (2.0.4)
|
103
|
+
concurrent-ruby (~> 1.0)
|
104
|
+
waterdrop (1.4.4)
|
120
105
|
delivery_boy (>= 0.2, < 2.x)
|
121
|
-
dry-configurable (~> 0.
|
122
|
-
dry-monitor (~> 0.
|
123
|
-
dry-validation (~> 1.
|
124
|
-
ruby-kafka (>=
|
125
|
-
zeitwerk (~> 2.
|
126
|
-
zeitwerk (2.4
|
106
|
+
dry-configurable (~> 0.13)
|
107
|
+
dry-monitor (~> 0.5)
|
108
|
+
dry-validation (~> 1.7)
|
109
|
+
ruby-kafka (>= 1.3.0)
|
110
|
+
zeitwerk (~> 2.4)
|
111
|
+
zeitwerk (2.5.4)
|
127
112
|
|
128
113
|
PLATFORMS
|
129
|
-
|
114
|
+
x86_64-darwin
|
115
|
+
x86_64-linux
|
130
116
|
|
131
117
|
DEPENDENCIES
|
132
118
|
byebug
|
@@ -136,4 +122,4 @@ DEPENDENCIES
|
|
136
122
|
simplecov
|
137
123
|
|
138
124
|
BUNDLED WITH
|
139
|
-
2.
|
125
|
+
2.3.6
|
data/README.md
CHANGED
@@ -1,15 +1,33 @@
|
|
1
1
|
![karafka logo](https://raw.githubusercontent.com/karafka/misc/master/logo/karafka_logotype_transparent2.png)
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/karafka/karafka/actions/workflows/ci.yml/badge.svg)](https://github.com/karafka/karafka/actions/workflows/ci.yml)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/karafka.svg)](http://badge.fury.io/rb/karafka)
|
5
|
+
[![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)
|
4
6
|
|
5
|
-
**Note**:
|
6
|
-
|
7
|
-
If you are looking for the documentation for Karafka `1.3.x`, it can be found [here](https://github.com/karafka/wiki/tree/1.3).
|
7
|
+
**Note**: We're finishing the new Karafka `2.0` but for now, please use `1.4`. All the documentation presented here refers to `1.4`
|
8
8
|
|
9
9
|
## About Karafka
|
10
10
|
|
11
11
|
Framework used to simplify Apache Kafka based Ruby applications development.
|
12
12
|
|
13
|
+
```ruby
|
14
|
+
# Define what topics you want to consume with which consumers
|
15
|
+
Karafka::App.consumer_groups.draw do
|
16
|
+
topic 'system_events' do
|
17
|
+
consumer EventsConsumer
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# And create your consumers, within which your messages will be processed
|
22
|
+
class EventsConsumer < ApplicationConsumer
|
23
|
+
# Example that utilizes ActiveRecord#insert_all and Karafka batch processing
|
24
|
+
def consume
|
25
|
+
# Store all of the incoming Kafka events locally in an efficient way
|
26
|
+
Event.insert_all params_batch.payloads
|
27
|
+
end
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
13
31
|
Karafka allows you to capture everything that happens in your systems in large scale, providing you with a seamless and stable core for consuming and processing this data, without having to focus on things that are not your business domain.
|
14
32
|
|
15
33
|
Karafka not only handles incoming messages but also provides tools for building complex data-flow applications that receive and send messages.
|
@@ -35,7 +53,7 @@ Karafka based applications can be easily deployed to any type of infrastructure,
|
|
35
53
|
|
36
54
|
## Support
|
37
55
|
|
38
|
-
Karafka has
|
56
|
+
Karafka has [Wiki pages](https://github.com/karafka/karafka/wiki) for almost everything and a pretty decent [FAQ](https://github.com/karafka/karafka/wiki/FAQ). It covers the whole installation, setup, and deployment along with other useful details on how to run Karafka.
|
39
57
|
|
40
58
|
If you have any questions about using Karafka, feel free to join our [Gitter](https://gitter.im/karafka/karafka) chat channel.
|
41
59
|
|
@@ -65,35 +83,16 @@ and follow the instructions from the [example app Wiki](https://github.com/karaf
|
|
65
83
|
|
66
84
|
If you need more details and know how on how to start Karafka with a clean installation, read the [Getting started page](https://github.com/karafka/karafka/wiki/Getting-started) section of our Wiki.
|
67
85
|
|
68
|
-
## Notice
|
69
|
-
|
70
|
-
Karafka framework and Karafka team are __not__ related to Kafka streaming service called CloudKarafka in any matter. We don't recommend nor discourage usage of their platform.
|
71
|
-
|
72
86
|
## References
|
73
87
|
|
74
88
|
* [Karafka framework](https://github.com/karafka/karafka)
|
75
|
-
* [Karafka
|
89
|
+
* [Karafka GitHub Actions](https://github.com/karafka/karafka/actions)
|
76
90
|
* [Karafka Coditsu](https://app.coditsu.io/karafka/repositories/karafka)
|
77
91
|
|
78
92
|
## Note on contributions
|
79
93
|
|
80
|
-
First, thank you for considering contributing to Karafka! It's people like you that make the open source community such a great community!
|
81
|
-
|
82
|
-
Each pull request must pass all the RSpec specs and meet our quality requirements.
|
83
|
-
|
84
|
-
To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combines multiple linters and code analyzers for both code and documentation. Once you're done with your changes, submit a pull request.
|
85
|
-
|
86
|
-
Coditsu will automatically check your work against our quality standards. You can find your commit check results on the [builds page](https://app.coditsu.io/karafka/commit_builds) of Karafka organization.
|
87
|
-
|
88
|
-
[![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://app.coditsu.io/karafka/commit_builds)
|
89
|
-
|
90
|
-
## Contributors
|
91
|
-
|
92
|
-
This project exists thanks to all the people who contribute.
|
93
|
-
<a href="https://github.com/karafka/karafka/graphs/contributors"><img src="https://opencollective.com/karafka/contributors.svg?width=890" /></a>
|
94
|
-
|
95
|
-
## Sponsors
|
94
|
+
First, thank you for considering contributing to the Karafka ecosystem! It's people like you that make the open source community such a great community!
|
96
95
|
|
97
|
-
|
96
|
+
Each pull request must pass all the RSpec specs, integration tests and meet our quality requirements.
|
98
97
|
|
99
|
-
|
98
|
+
Fork it, update and wait for the Github Actions results.
|
data/certs/mensfeld.pem
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjEwODExMTQxNTEzWhcNMjIwODExMTQx
|
4
|
+
NTEzWjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
|
5
|
+
CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDV2jKH4Ti87GM6nyT6D+ESzTI0MZDj
|
6
|
+
ak2/TEwnxvijMJyCCPKT/qIkbW4/f0VHM4rhPr1nW73sb5SZBVFCLlJcOSKOBdUY
|
7
|
+
TMY+SIXN2EtUaZuhAOe8LxtxjHTgRHvHcqUQMBENXTISNzCo32LnUxweu66ia4Pd
|
8
|
+
1mNRhzOqNv9YiBZvtBf7IMQ+sYdOCjboq2dlsWmJiwiDpY9lQBTnWORnT3mQxU5x
|
9
|
+
vPSwnLB854cHdCS8fQo4DjeJBRZHhEbcE5sqhEMB3RZA3EtFVEXOxlNxVTS3tncI
|
10
|
+
qyNXiWDaxcipaens4ObSY1C2HTV7OWb7OMqSCIybeYTSfkaSdqmcl4S6zxXkjH1J
|
11
|
+
tnjayAVzD+QVXGijsPLE2PFnJAh9iDET2cMsjabO1f6l1OQNyAtqpcyQcgfnyW0z
|
12
|
+
g7tGxTYD+6wJHffM9d9txOUw6djkF6bDxyqB8lo4Z3IObCx18AZjI9XPS9QG7w6q
|
13
|
+
LCWuMG2lkCcRgASqaVk9fEf9yMc2xxz5o3kCAwEAAaN3MHUwCQYDVR0TBAIwADAL
|
14
|
+
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFBqUFCKCOe5IuueUVqOB991jyCLLMB0GA1Ud
|
15
15
|
EQQWMBSBEm1hY2llakBtZW5zZmVsZC5wbDAdBgNVHRIEFjAUgRJtYWNpZWpAbWVu
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
c2ZlbGQucGwwDQYJKoZIhvcNAQELBQADggGBADD0/UuTTFgW+CGk2U0RDw2RBOca
|
17
|
+
W2LTF/G7AOzuzD0Tc4voc7WXyrgKwJREv8rgBimLnNlgmFJLmtUCh2U/MgxvcilH
|
18
|
+
yshYcbseNvjkrtYnLRlWZR4SSB6Zei5AlyGVQLPkvdsBpNegcG6w075YEwzX/38a
|
19
|
+
8V9B/Yri2OGELBz8ykl7BsXUgNoUPA/4pHF6YRLz+VirOaUIQ4JfY7xGj6fSOWWz
|
20
|
+
/rQ/d77r6o1mfJYM/3BRVg73a3b7DmRnE5qjwmSaSQ7u802pJnLesmArch0xGCT/
|
21
|
+
fMmRli1Qb+6qOTl9mzD6UDMAyFR4t6MStLm0mIEqM0nBO5nUdUWbC7l9qXEf8XBE
|
22
|
+
2DP28p3EqSuS+lKbAWKcqv7t0iRhhmaod+Yn9mcrLN1sa3q3KSQ9BCyxezCD4Mk2
|
23
|
+
R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
|
24
|
+
pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
|
25
25
|
-----END CERTIFICATE-----
|
data/config/errors.yml
CHANGED
data/karafka.gemspec
CHANGED
@@ -12,24 +12,22 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.platform = Gem::Platform::RUBY
|
13
13
|
spec.authors = ['Maciej Mensfeld', 'Pavlo Vavruk', 'Adam Gwozdowski']
|
14
14
|
spec.email = %w[maciej@mensfeld.pl pavlo.vavruk@gmail.com adam99g@gmail.com]
|
15
|
-
spec.homepage = 'https://
|
15
|
+
spec.homepage = 'https://karafka.io'
|
16
16
|
spec.summary = 'Ruby based framework for working with Apache Kafka'
|
17
17
|
spec.description = 'Framework used to simplify Apache Kafka based Ruby applications development'
|
18
18
|
spec.license = 'MIT'
|
19
19
|
|
20
|
-
spec.add_dependency 'dry-configurable', '~> 0.
|
21
|
-
spec.add_dependency 'dry-inflector', '~> 0.
|
22
|
-
spec.add_dependency 'dry-monitor', '~> 0.
|
23
|
-
spec.add_dependency 'dry-validation', '~> 1.
|
20
|
+
spec.add_dependency 'dry-configurable', '~> 0.13'
|
21
|
+
spec.add_dependency 'dry-inflector', '~> 0.2'
|
22
|
+
spec.add_dependency 'dry-monitor', '~> 0.5'
|
23
|
+
spec.add_dependency 'dry-validation', '~> 1.7'
|
24
24
|
spec.add_dependency 'envlogic', '~> 1.1'
|
25
|
-
spec.add_dependency '
|
26
|
-
spec.add_dependency '
|
27
|
-
spec.add_dependency '
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency 'waterdrop', '~> 1.4.0'
|
30
|
-
spec.add_dependency 'zeitwerk', '~> 2.1'
|
25
|
+
spec.add_dependency 'ruby-kafka', '>= 1.3.0'
|
26
|
+
spec.add_dependency 'thor', '>= 1.1'
|
27
|
+
spec.add_dependency 'waterdrop', '~> 1.4'
|
28
|
+
spec.add_dependency 'zeitwerk', '~> 2.4'
|
31
29
|
|
32
|
-
spec.required_ruby_version = '>= 2.
|
30
|
+
spec.required_ruby_version = '>= 2.7'
|
33
31
|
|
34
32
|
if $PROGRAM_NAME.end_with?('gem')
|
35
33
|
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
|
@@ -39,5 +37,10 @@ Gem::Specification.new do |spec|
|
|
39
37
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
40
38
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
41
39
|
spec.require_paths = %w[lib]
|
40
|
+
|
41
|
+
spec.metadata = {
|
42
|
+
'source_code_uri' => 'https://github.com/karafka/karafka',
|
43
|
+
'rubygems_mfa_required' => 'true'
|
44
|
+
}
|
42
45
|
end
|
43
46
|
# rubocop:enable Metrics/BlockLength
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Karafka
|
4
|
+
# Strategies for Kafka partitions assignments
|
5
|
+
module AssignmentStrategies
|
6
|
+
# Standard RoundRobin strategy
|
7
|
+
class RoundRobin < SimpleDelegator
|
8
|
+
def initialize
|
9
|
+
super(Kafka::RoundRobinAssignmentStrategy.new)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -19,6 +19,7 @@ module Karafka
|
|
19
19
|
consumer: %i[
|
20
20
|
session_timeout offset_commit_interval offset_commit_threshold
|
21
21
|
offset_retention_time heartbeat_interval fetcher_max_queue_size
|
22
|
+
assignment_strategy
|
22
23
|
],
|
23
24
|
subscribe: %i[start_from_beginning max_bytes_per_partition],
|
24
25
|
consumption: %i[min_bytes max_bytes max_wait_time],
|
data/lib/karafka/cli/base.rb
CHANGED
@@ -43,16 +43,16 @@ module Karafka
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# Allows to set description of a given cli command
|
46
|
-
# @param
|
47
|
-
def desc(
|
48
|
-
@desc ||=
|
46
|
+
# @param args [Array] All the arguments that Thor desc method accepts
|
47
|
+
def desc(*args)
|
48
|
+
@desc ||= args
|
49
49
|
end
|
50
50
|
|
51
51
|
# This method will bind a given Cli command into Karafka Cli
|
52
52
|
# This method is a wrapper to way Thor defines its commands
|
53
53
|
# @param cli_class [Karafka::Cli] Karafka cli_class
|
54
54
|
def bind_to(cli_class)
|
55
|
-
cli_class.desc name,
|
55
|
+
cli_class.desc name, *@desc
|
56
56
|
|
57
57
|
(@options || []).each { |option| cli_class.option(*option) }
|
58
58
|
|
data/lib/karafka/cli/install.rb
CHANGED
@@ -30,11 +30,12 @@ module Karafka
|
|
30
30
|
# @param args [Array] all the things that Thor CLI accepts
|
31
31
|
def initialize(*args)
|
32
32
|
super
|
33
|
-
|
33
|
+
dependencies = Bundler::LockfileParser.new(
|
34
34
|
Bundler.read_file(
|
35
35
|
Bundler.default_lockfile
|
36
36
|
)
|
37
|
-
).dependencies
|
37
|
+
).dependencies
|
38
|
+
@rails = dependencies.key?('railties') || dependencies.key?('rails')
|
38
39
|
end
|
39
40
|
|
40
41
|
# Install all required things for Karafka application in current directory
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Karafka
|
4
|
+
class Cli < Thor
|
5
|
+
# Command that gets invoked when no method is provided when running the CLI
|
6
|
+
# It allows us to exit with exit code 1 instead of default 0 to indicate that something
|
7
|
+
# was missing
|
8
|
+
# @see https://github.com/karafka/karafka/issues/619
|
9
|
+
class Missingno < Base
|
10
|
+
desc 'Hidden command that gets invoked when no command is provided', hide: true
|
11
|
+
|
12
|
+
# Prints an error about the lack of command (nothing selected)
|
13
|
+
def call
|
14
|
+
Karafka.logger.error('No command provided')
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/karafka/cli/server.rb
CHANGED
@@ -31,14 +31,6 @@ module Karafka
|
|
31
31
|
# part of the topics
|
32
32
|
Karafka::Server.consumer_groups = cli.options[:consumer_groups]
|
33
33
|
|
34
|
-
# Remove pidfile on stop, just before the server instance is going to be GCed
|
35
|
-
# We want to delay the moment in which the pidfile is removed as much as we can,
|
36
|
-
# so instead of removing it after the server stops running, we rely on the gc moment
|
37
|
-
# when this object gets removed (it is a bit later), so it is closer to the actual
|
38
|
-
# system process end. We do that, so monitoring and deployment tools that rely on a pid
|
39
|
-
# won't alarm or start new system process up until the current one is finished
|
40
|
-
ObjectSpace.define_finalizer(self, proc { send(:clean) })
|
41
|
-
|
42
34
|
Karafka::Server.run
|
43
35
|
end
|
44
36
|
|
@@ -60,6 +52,14 @@ module Karafka
|
|
60
52
|
cli.options[:pid],
|
61
53
|
'w'
|
62
54
|
) { |file| file.write(::Process.pid) }
|
55
|
+
|
56
|
+
# Remove pidfile on stop, just before the server instance is going to be GCed
|
57
|
+
# We want to delay the moment in which the pidfile is removed as much as we can,
|
58
|
+
# so instead of removing it after the server stops running, we rely on the gc moment
|
59
|
+
# when this object gets removed (it is a bit later), so it is closer to the actual
|
60
|
+
# system process end. We do that, so monitoring and deployment tools that rely on a pid
|
61
|
+
# won't alarm or start new system process up until the current one is finished
|
62
|
+
ObjectSpace.define_finalizer(self, proc { send(:clean) })
|
63
63
|
end
|
64
64
|
|
65
65
|
# Removes a pidfile (if exist)
|