karafka 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +4 -8
- data/CHANGELOG.md +50 -2
- data/CONTRIBUTING.md +5 -6
- data/Gemfile +1 -2
- data/Gemfile.lock +43 -31
- data/README.md +13 -21
- data/karafka.gemspec +6 -4
- data/lib/karafka.rb +17 -7
- data/lib/karafka/app.rb +8 -15
- data/lib/karafka/attributes_map.rb +1 -1
- data/lib/karafka/backends/inline.rb +1 -2
- data/lib/karafka/{base_controller.rb → base_consumer.rb} +19 -11
- data/lib/karafka/base_responder.rb +34 -15
- data/lib/karafka/callbacks.rb +30 -0
- data/lib/karafka/callbacks/config.rb +22 -0
- data/lib/karafka/callbacks/dsl.rb +16 -0
- data/lib/karafka/cli/install.rb +2 -3
- data/lib/karafka/cli/server.rb +0 -1
- data/lib/karafka/connection/{consumer.rb → client.rb} +32 -36
- data/lib/karafka/connection/config_adapter.rb +14 -6
- data/lib/karafka/connection/delegator.rb +46 -0
- data/lib/karafka/connection/listener.rb +22 -13
- data/lib/karafka/{controllers → consumers}/callbacks.rb +9 -9
- data/lib/karafka/consumers/includer.rb +51 -0
- data/lib/karafka/consumers/responders.rb +24 -0
- data/lib/karafka/{controllers → consumers}/single_params.rb +3 -3
- data/lib/karafka/errors.rb +13 -3
- data/lib/karafka/fetcher.rb +30 -34
- data/lib/karafka/helpers/class_matcher.rb +8 -8
- data/lib/karafka/helpers/config_retriever.rb +2 -2
- data/lib/karafka/instrumentation/listener.rb +112 -0
- data/lib/karafka/instrumentation/logger.rb +55 -0
- data/lib/karafka/instrumentation/monitor.rb +64 -0
- data/lib/karafka/loader.rb +0 -1
- data/lib/karafka/params/{params.rb → dsl.rb} +71 -43
- data/lib/karafka/params/params_batch.rb +7 -2
- data/lib/karafka/patches/dry_configurable.rb +6 -2
- data/lib/karafka/patches/ruby_kafka.rb +10 -10
- data/lib/karafka/persistence/client.rb +25 -0
- data/lib/karafka/persistence/consumer.rb +27 -14
- data/lib/karafka/persistence/topic.rb +29 -0
- data/lib/karafka/process.rb +5 -4
- data/lib/karafka/responders/builder.rb +15 -14
- data/lib/karafka/routing/builder.rb +1 -1
- data/lib/karafka/routing/consumer_mapper.rb +3 -2
- data/lib/karafka/routing/router.rb +1 -1
- data/lib/karafka/routing/topic.rb +5 -11
- data/lib/karafka/schemas/config.rb +3 -0
- data/lib/karafka/schemas/consumer_group.rb +15 -3
- data/lib/karafka/schemas/consumer_group_topic.rb +1 -1
- data/lib/karafka/server.rb +44 -5
- data/lib/karafka/setup/config.rb +47 -21
- data/lib/karafka/setup/configurators/base.rb +6 -12
- data/lib/karafka/setup/configurators/params.rb +25 -0
- data/lib/karafka/setup/configurators/water_drop.rb +6 -3
- data/lib/karafka/setup/dsl.rb +22 -0
- data/lib/karafka/templates/{application_controller.rb.example → application_consumer.rb.example} +2 -3
- data/lib/karafka/templates/karafka.rb.example +17 -4
- data/lib/karafka/version.rb +1 -1
- metadata +58 -24
- data/.github/ISSUE_TEMPLATE.md +0 -2
- data/lib/karafka/connection/processor.rb +0 -61
- data/lib/karafka/controllers/includer.rb +0 -51
- data/lib/karafka/controllers/responders.rb +0 -19
- data/lib/karafka/logger.rb +0 -53
- data/lib/karafka/monitor.rb +0 -98
- data/lib/karafka/persistence/controller.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b9dc0bdd3ac35d6c39ff0a346a1c4bf4e722ed0c58ae91f4b52369b5855a5f4c
|
4
|
+
data.tar.gz: 1a54a505b51bb7152101c94084eaecfded9a030dbaf3823c0148bf2732bfb5ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12f08420da02321a089da6e4d20d445bec75cccbbad682a7939deeb7fae7787c93e6adffd6c6f6e4ebe6d1dfc9b72443d08f6f300e4c4badc028621a9c510e14
|
7
|
+
data.tar.gz: 66b8f7382bf4beead971fe3ff9e40b439802e145f0a8dc9c0f116631ba460a961983ded0b897414505b4fe0178ff6c8dbb1e7b7c1a2e775207487c8e14783b4e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,53 @@
|
|
1
1
|
# Karafka framework changelog
|
2
2
|
|
3
|
-
## 1.1
|
3
|
+
## 1.2.1
|
4
|
+
- #304 - Unification of error instrumentation event details
|
5
|
+
- #306 - Using file logger from within a trap context upon shutdown is impossible
|
6
|
+
|
7
|
+
## 1.2.0
|
8
|
+
- Spec improvements
|
9
|
+
- #260 - Specs missing randomization
|
10
|
+
- #251 - Shutdown upon non responding (unreachable) cluster is not possible
|
11
|
+
- #258 - Investigate lowering requirements on activesupport
|
12
|
+
- #246 - Alias consumer#mark_as_consumed on controller
|
13
|
+
- #259 - Allow forcing key/partition key on responders
|
14
|
+
- #267 - Styling inconsistency
|
15
|
+
- #242 - Support setting the max bytes to fetch per request
|
16
|
+
- #247 - Support SCRAM once released
|
17
|
+
- #271 - Provide an after_init option to pass a configuration block
|
18
|
+
- #262 - Error in the monitor code for NewRelic
|
19
|
+
- #241 - Performance metrics
|
20
|
+
- #274 - Rename controllers to consumers
|
21
|
+
- #184 - Seek to
|
22
|
+
- #284 - Dynamic Params parent class
|
23
|
+
- #275 - ssl_ca_certs_from_system
|
24
|
+
- #296 - Instrument forceful exit with an error
|
25
|
+
- Replaced some of the activesupport parts with dry-inflector
|
26
|
+
- Lower ActiveSupport dependency
|
27
|
+
- Remove configurators in favor of the after_init block configurator
|
28
|
+
- Ruby 2.5.0 support
|
29
|
+
- Renamed Karafka::Connection::Processor to Karafka::Connection::Delegator to match incoming naming conventions
|
30
|
+
- Renamed Karafka::Connection::Consumer to Karafka::Connection::Client due to #274
|
31
|
+
- Removed HashWithIndifferentAccess in favor of a regular hash
|
32
|
+
- JSON parsing defaults now to string keys
|
33
|
+
- Lower memory usage due to less params data internal details
|
34
|
+
- Support multiple ```after_init``` blocks in favor of a single one
|
35
|
+
- Renamed ```received_at``` to ```receive_time``` to follow ruby-kafka and WaterDrop conventions
|
36
|
+
- Adjust internal setup to easier map Ruby-Kafka config changes
|
37
|
+
- System callbacks reorganization
|
38
|
+
- Added ```before_fetch_loop``` configuration block for early client usage (```#seek```, etc)
|
39
|
+
- Renamed ```after_fetched``` to ```after_fetch``` to normalize the naming convention
|
40
|
+
- Instrumentation on a connection delegator level
|
41
|
+
- Added ```params_batch#last``` method to retrieve last element after unparsing
|
42
|
+
- All params keys are now strings
|
43
|
+
|
44
|
+
## 1.1.2
|
45
|
+
- #256 - Default kafka.seed_brokers configuration is created in invalid format
|
46
|
+
|
47
|
+
## 1.1.1
|
48
|
+
- #253 - Allow providing a global per app parser in config settings
|
49
|
+
|
50
|
+
## 1.1.0
|
4
51
|
- Gem bump
|
5
52
|
- Switch from Celluloid to native Thread management
|
6
53
|
- Improved shutdown process
|
@@ -14,7 +61,7 @@
|
|
14
61
|
- Fixed accessibility of ```#params_batch``` from the outside of the controller
|
15
62
|
- connection_pool config options are no longer required
|
16
63
|
- celluloid config options are no longer required
|
17
|
-
- ```#perform``` is
|
64
|
+
- ```#perform``` is now renamed to ```#consume``` with warning level on using the old one (deprecated)
|
18
65
|
- #235 - Rename perform to consume
|
19
66
|
- Upgrade to ruby-kafka 0.5
|
20
67
|
- Due to redesign of Waterdrop concurrency setting is no longer needed
|
@@ -23,6 +70,7 @@
|
|
23
70
|
- Renamed ```batch_consuming``` option to ```batch_fetching``` as it is not a consumption (with processing) but a process of fetching messages from Kafka. The messages is considered consumed, when it is processed.
|
24
71
|
- Renamed ```batch_processing``` to ```batch_consuming``` to resemble Kafka concept of consuming messages.
|
25
72
|
- Renamed ```after_received``` to ```after_fetched``` to normalize the naming conventions.
|
73
|
+
- Responders support the per topic ```async``` option.
|
26
74
|
|
27
75
|
## 1.0.1
|
28
76
|
- #210 - LoadError: cannot load such file -- [...]/karafka.rb
|
data/CONTRIBUTING.md
CHANGED
@@ -9,7 +9,6 @@ We welcome any type of contribution, not only code. You can help with
|
|
9
9
|
- **Marketing**: writing blog posts, howto's, printing stickers, ...
|
10
10
|
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
|
11
11
|
- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
|
12
|
-
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/karafka).
|
13
12
|
|
14
13
|
## Your First Contribution
|
15
14
|
|
@@ -21,13 +20,13 @@ Any code change should be submitted as a pull request. The description should ex
|
|
21
20
|
|
22
21
|
## Code review process
|
23
22
|
|
24
|
-
|
25
|
-
It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
|
23
|
+
Each pull request must pass all the rspec specs and meet our quality requirements.
|
26
24
|
|
27
|
-
|
25
|
+
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.
|
28
26
|
|
29
|
-
|
30
|
-
|
27
|
+
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.
|
28
|
+
|
29
|
+
[![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://app.coditsu.io/karafka/commit_builds)
|
31
30
|
|
32
31
|
## Questions
|
33
32
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,44 +1,56 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka (1.1
|
5
|
-
activesupport (>=
|
4
|
+
karafka (1.2.1)
|
5
|
+
activesupport (>= 4.0)
|
6
6
|
dry-configurable (~> 0.7)
|
7
|
+
dry-inflector (~> 0.1.1)
|
8
|
+
dry-monitor (~> 0.1)
|
7
9
|
dry-validation (~> 0.11)
|
8
10
|
envlogic (~> 1.0)
|
9
11
|
multi_json (>= 1.12)
|
10
12
|
rake (>= 11.3)
|
11
13
|
require_all (>= 1.4)
|
12
|
-
ruby-kafka (>= 0.5)
|
14
|
+
ruby-kafka (>= 0.5.3)
|
13
15
|
thor (~> 0.19)
|
14
|
-
waterdrop (
|
16
|
+
waterdrop (~> 1.2)
|
15
17
|
|
16
18
|
GEM
|
17
19
|
remote: https://rubygems.org/
|
18
20
|
specs:
|
19
|
-
activesupport (5.1.
|
21
|
+
activesupport (5.1.6)
|
20
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
-
i18n (
|
23
|
+
i18n (>= 0.7, < 2)
|
22
24
|
minitest (~> 5.1)
|
23
25
|
tzinfo (~> 1.1)
|
24
26
|
concurrent-ruby (1.0.5)
|
25
|
-
delivery_boy (0.2.
|
27
|
+
delivery_boy (0.2.4)
|
26
28
|
king_konf (~> 0.1.8)
|
27
|
-
ruby-kafka (~> 0.
|
29
|
+
ruby-kafka (~> 0.5.1)
|
28
30
|
diff-lcs (1.3)
|
29
|
-
docile (1.
|
31
|
+
docile (1.3.0)
|
30
32
|
dry-configurable (0.7.0)
|
31
33
|
concurrent-ruby (~> 1.0)
|
32
34
|
dry-container (0.6.0)
|
33
35
|
concurrent-ruby (~> 1.0)
|
34
36
|
dry-configurable (~> 0.1, >= 0.1.3)
|
35
|
-
dry-core (0.4.
|
37
|
+
dry-core (0.4.5)
|
36
38
|
concurrent-ruby (~> 1.0)
|
37
39
|
dry-equalizer (0.2.0)
|
40
|
+
dry-events (0.1.0)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
dry-core (~> 0.4)
|
43
|
+
dry-equalizer (~> 0.2)
|
44
|
+
dry-inflector (0.1.1)
|
38
45
|
dry-logic (0.4.2)
|
39
46
|
dry-container (~> 0.2, >= 0.2.6)
|
40
47
|
dry-core (~> 0.2)
|
41
48
|
dry-equalizer (~> 0.2)
|
49
|
+
dry-monitor (0.1.2)
|
50
|
+
dry-configurable (~> 0.5)
|
51
|
+
dry-equalizer (~> 0.2)
|
52
|
+
dry-events (~> 0.1)
|
53
|
+
rouge (~> 2.0, >= 2.2.1)
|
42
54
|
dry-types (0.12.2)
|
43
55
|
concurrent-ruby (~> 1.0)
|
44
56
|
dry-configurable (~> 0.1)
|
@@ -54,23 +66,24 @@ GEM
|
|
54
66
|
dry-equalizer (~> 0.2)
|
55
67
|
dry-logic (~> 0.4, >= 0.4.0)
|
56
68
|
dry-types (~> 0.12.0)
|
57
|
-
envlogic (1.0
|
58
|
-
|
59
|
-
i18n (0.
|
69
|
+
envlogic (1.1.0)
|
70
|
+
dry-inflector (~> 0.1)
|
71
|
+
i18n (1.0.0)
|
60
72
|
concurrent-ruby (~> 1.0)
|
61
73
|
inflecto (0.0.2)
|
62
74
|
json (2.1.0)
|
63
|
-
king_konf (0.1.
|
64
|
-
minitest (5.
|
65
|
-
multi_json (1.
|
66
|
-
null-logger (0.1.
|
67
|
-
rake (12.
|
68
|
-
require_all (
|
75
|
+
king_konf (0.1.10)
|
76
|
+
minitest (5.11.3)
|
77
|
+
multi_json (1.13.1)
|
78
|
+
null-logger (0.1.5)
|
79
|
+
rake (12.3.1)
|
80
|
+
require_all (2.0.0)
|
81
|
+
rouge (2.2.1)
|
69
82
|
rspec (3.7.0)
|
70
83
|
rspec-core (~> 3.7.0)
|
71
84
|
rspec-expectations (~> 3.7.0)
|
72
85
|
rspec-mocks (~> 3.7.0)
|
73
|
-
rspec-core (3.7.
|
86
|
+
rspec-core (3.7.1)
|
74
87
|
rspec-support (~> 3.7.0)
|
75
88
|
rspec-expectations (3.7.0)
|
76
89
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -78,24 +91,24 @@ GEM
|
|
78
91
|
rspec-mocks (3.7.0)
|
79
92
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
93
|
rspec-support (~> 3.7.0)
|
81
|
-
rspec-support (3.7.
|
82
|
-
ruby-kafka (0.5.
|
83
|
-
simplecov (0.
|
84
|
-
docile (~> 1.1
|
94
|
+
rspec-support (3.7.1)
|
95
|
+
ruby-kafka (0.5.4)
|
96
|
+
simplecov (0.16.1)
|
97
|
+
docile (~> 1.1)
|
85
98
|
json (>= 1.8, < 3)
|
86
99
|
simplecov-html (~> 0.10.0)
|
87
100
|
simplecov-html (0.10.2)
|
88
101
|
thor (0.20.0)
|
89
102
|
thread_safe (0.3.6)
|
90
103
|
timecop (0.9.1)
|
91
|
-
tzinfo (1.2.
|
104
|
+
tzinfo (1.2.5)
|
92
105
|
thread_safe (~> 0.1)
|
93
|
-
waterdrop (1.
|
94
|
-
delivery_boy (
|
106
|
+
waterdrop (1.2.2)
|
107
|
+
delivery_boy (~> 0.2)
|
95
108
|
dry-configurable (~> 0.7)
|
109
|
+
dry-monitor (~> 0.1)
|
96
110
|
dry-validation (~> 0.11)
|
97
|
-
null-logger
|
98
|
-
ruby-kafka (>= 0.5)
|
111
|
+
null-logger (~> 0.1)
|
99
112
|
|
100
113
|
PLATFORMS
|
101
114
|
ruby
|
@@ -105,7 +118,6 @@ DEPENDENCIES
|
|
105
118
|
rspec
|
106
119
|
simplecov
|
107
120
|
timecop
|
108
|
-
waterdrop
|
109
121
|
|
110
122
|
BUNDLED WITH
|
111
|
-
1.
|
123
|
+
1.16.1
|
data/README.md
CHANGED
@@ -4,20 +4,21 @@
|
|
4
4
|
|
5
5
|
Framework used to simplify Apache Kafka based Ruby applications development.
|
6
6
|
|
7
|
-
|
7
|
+
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.
|
8
8
|
|
9
9
|
Karafka not only handles incoming messages but also provides tools for building complex data-flow applications that receive and send messages.
|
10
10
|
|
11
11
|
## How does it work
|
12
12
|
|
13
|
-
Karafka provides a higher-level abstraction that allows you to focus on your business logic development, instead of focusing on implementing lower level abstraction layers. It provides developers with a set of tools that are dedicated for building multi-topic applications
|
13
|
+
Karafka provides a higher-level abstraction that allows you to focus on your business logic development, instead of focusing on implementing lower level abstraction layers. It provides developers with a set of tools that are dedicated for building multi-topic applications similar to how Rails applications are being built.
|
14
14
|
|
15
15
|
### Some things you might wonder about:
|
16
16
|
|
17
|
-
- You can integrate Karafka with any Ruby
|
17
|
+
- You can integrate Karafka with **any** Ruby-based application.
|
18
18
|
- Karafka does **not** require Sidekiq or any other third party software (apart from Kafka itself).
|
19
|
-
- Karafka works with Ruby on Rails but it is a standalone framework that can work without it.
|
20
|
-
- Karafka has a minimal set of dependencies, so adding it won't be a huge burden for your already existing applications.
|
19
|
+
- Karafka works with Ruby on Rails but it is a **standalone** framework that can work without it.
|
20
|
+
- Karafka has a **minimal** set of dependencies, so adding it won't be a huge burden for your already existing applications.
|
21
|
+
- Karafka processes can be executed for a **given subset** of consumer groups and/or topics, so you can fine tune it depending on your business logic.
|
21
22
|
|
22
23
|
Karafka based applications can be easily deployed to any type of infrastructure, including those based on:
|
23
24
|
|
@@ -27,7 +28,7 @@ Karafka based applications can be easily deployed to any type of infrastructure,
|
|
27
28
|
|
28
29
|
## Support
|
29
30
|
|
30
|
-
Karafka has a [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.
|
31
|
+
Karafka has a [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.
|
31
32
|
|
32
33
|
If you have any questions about using Karafka, feel free to join our [Gitter](https://gitter.im/karafka/karafka) chat channel.
|
33
34
|
|
@@ -62,26 +63,17 @@ Karafka framework and Karafka team are __not__ related to Kafka streaming servic
|
|
62
63
|
* [Karafka Travis CI](https://travis-ci.org/karafka/karafka)
|
63
64
|
* [Karafka Coditsu](https://app.coditsu.io/karafka/repositories/karafka)
|
64
65
|
|
65
|
-
## Note on
|
66
|
+
## Note on contributions
|
66
67
|
|
67
|
-
|
68
|
-
Make your feature addition or bug fix.
|
69
|
-
Add tests for it. This is important so we don't break it in a future versions unintentionally.
|
70
|
-
Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull). Send me a pull request. Bonus points for topic branches.
|
68
|
+
First, thank you for considering contributing to Karafka! It's people like you that make the open source community such a great community!
|
71
69
|
|
72
|
-
|
70
|
+
Each pull request must pass all the RSpec specs and meet our quality requirements.
|
73
71
|
|
74
|
-
|
72
|
+
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.
|
75
73
|
|
76
|
-
|
74
|
+
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.
|
77
75
|
|
78
|
-
|
79
|
-
|
80
|
-
```bash
|
81
|
-
bundle exec rspec
|
82
|
-
```
|
83
|
-
|
84
|
-
to check if everything is in order. After that you can submit a pull request.
|
76
|
+
[![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://app.coditsu.io/karafka/commit_builds)
|
85
77
|
|
86
78
|
## Contributors
|
87
79
|
|
data/karafka.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
|
6
6
|
require 'karafka/version'
|
@@ -16,16 +16,18 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.description = 'Framework used to simplify Apache Kafka based Ruby applications development'
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
|
-
spec.add_dependency 'activesupport', '>=
|
19
|
+
spec.add_dependency 'activesupport', '>= 4.0'
|
20
20
|
spec.add_dependency 'dry-configurable', '~> 0.7'
|
21
|
+
spec.add_dependency 'dry-inflector', '~> 0.1.1'
|
22
|
+
spec.add_dependency 'dry-monitor', '~> 0.1'
|
21
23
|
spec.add_dependency 'dry-validation', '~> 0.11'
|
22
24
|
spec.add_dependency 'envlogic', '~> 1.0'
|
23
25
|
spec.add_dependency 'multi_json', '>= 1.12'
|
24
26
|
spec.add_dependency 'rake', '>= 11.3'
|
25
27
|
spec.add_dependency 'require_all', '>= 1.4'
|
26
|
-
spec.add_dependency 'ruby-kafka', '>= 0.5'
|
28
|
+
spec.add_dependency 'ruby-kafka', '>= 0.5.3'
|
27
29
|
spec.add_dependency 'thor', '~> 0.19'
|
28
|
-
spec.add_dependency 'waterdrop', '
|
30
|
+
spec.add_dependency 'waterdrop', '~> 1.2'
|
29
31
|
|
30
32
|
spec.required_ruby_version = '>= 2.3.0'
|
31
33
|
|
data/lib/karafka.rb
CHANGED
@@ -11,10 +11,9 @@
|
|
11
11
|
require_all
|
12
12
|
dry-configurable
|
13
13
|
dry-validation
|
14
|
+
dry/inflector
|
15
|
+
dry/monitor/notifications
|
14
16
|
active_support/callbacks
|
15
|
-
active_support/core_ext/hash/indifferent_access
|
16
|
-
active_support/descendants_tracker
|
17
|
-
active_support/inflector
|
18
17
|
karafka/loader
|
19
18
|
].each(&method(:require))
|
20
19
|
|
@@ -28,14 +27,14 @@ module Karafka
|
|
28
27
|
@logger ||= App.config.logger
|
29
28
|
end
|
30
29
|
|
31
|
-
# @return [::Karafka::Monitor] monitor that we want to use
|
30
|
+
# @return [::Karafka::Monitor] monitor that we want to use
|
32
31
|
def monitor
|
33
32
|
@monitor ||= App.config.monitor
|
34
33
|
end
|
35
34
|
|
36
35
|
# @return [String] root path of this gem
|
37
36
|
def gem_root
|
38
|
-
Pathname.new(File.expand_path('
|
37
|
+
Pathname.new(File.expand_path('..', __dir__))
|
39
38
|
end
|
40
39
|
|
41
40
|
# @return [String] Karafka app root path (user application path)
|
@@ -45,13 +44,13 @@ module Karafka
|
|
45
44
|
|
46
45
|
# @return [String] path to Karafka gem root core
|
47
46
|
def core_root
|
48
|
-
Pathname.new(File.expand_path('
|
47
|
+
Pathname.new(File.expand_path('karafka', __dir__))
|
49
48
|
end
|
50
49
|
|
51
50
|
# @return [String] path to a default file that contains booting procedure etc
|
52
51
|
# @note By default it is a file called 'karafka.rb' but it can be specified as you wish if you
|
53
52
|
# have Karafka that is merged into a Sinatra/Rails app and karafka.rb is taken.
|
54
|
-
# It will be used for console/
|
53
|
+
# It will be used for console/consumers/etc
|
55
54
|
# @example Standard only-Karafka case
|
56
55
|
# Karafka.boot_file #=> '/home/app_path/karafka.rb'
|
57
56
|
# @example Non standard case
|
@@ -63,6 +62,17 @@ module Karafka
|
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
65
|
+
%w[
|
66
|
+
callbacks
|
67
|
+
callbacks/*
|
68
|
+
setup/dsl
|
69
|
+
setup/config
|
70
|
+
status
|
71
|
+
schemas/config
|
72
|
+
schemas/consumer_group_topic
|
73
|
+
schemas/consumer_group
|
74
|
+
].each { |path| require_all File.join(Karafka.core_root, path + '.rb') }
|
75
|
+
|
66
76
|
Karafka::Loader.load!(Karafka.core_root)
|
67
77
|
Kafka::Consumer.prepend(Karafka::Patches::RubyKafka)
|
68
78
|
Dry::Configurable::Config.prepend(Karafka::Patches::DryConfigurable)
|