karafka 1.4.0 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +89 -18
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +365 -1
  6. data/CONTRIBUTING.md +10 -19
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +56 -112
  9. data/LICENSE +17 -0
  10. data/LICENSE-COMM +89 -0
  11. data/LICENSE-LGPL +165 -0
  12. data/README.md +61 -68
  13. data/bin/benchmarks +85 -0
  14. data/bin/create_token +22 -0
  15. data/bin/integrations +272 -0
  16. data/bin/karafka +10 -0
  17. data/bin/scenario +29 -0
  18. data/bin/stress_many +13 -0
  19. data/bin/stress_one +13 -0
  20. data/certs/cert_chain.pem +26 -0
  21. data/certs/karafka-pro.pem +11 -0
  22. data/config/errors.yml +59 -38
  23. data/docker-compose.yml +10 -3
  24. data/karafka.gemspec +18 -21
  25. data/lib/active_job/karafka.rb +21 -0
  26. data/lib/active_job/queue_adapters/karafka_adapter.rb +26 -0
  27. data/lib/karafka/active_job/consumer.rb +26 -0
  28. data/lib/karafka/active_job/dispatcher.rb +38 -0
  29. data/lib/karafka/active_job/job_extensions.rb +34 -0
  30. data/lib/karafka/active_job/job_options_contract.rb +21 -0
  31. data/lib/karafka/active_job/routing/extensions.rb +33 -0
  32. data/lib/karafka/admin.rb +63 -0
  33. data/lib/karafka/app.rb +15 -20
  34. data/lib/karafka/base_consumer.rb +197 -31
  35. data/lib/karafka/cli/info.rb +44 -10
  36. data/lib/karafka/cli/install.rb +22 -12
  37. data/lib/karafka/cli/server.rb +17 -42
  38. data/lib/karafka/cli.rb +4 -3
  39. data/lib/karafka/connection/client.rb +379 -89
  40. data/lib/karafka/connection/listener.rb +250 -38
  41. data/lib/karafka/connection/listeners_batch.rb +24 -0
  42. data/lib/karafka/connection/messages_buffer.rb +84 -0
  43. data/lib/karafka/connection/pauses_manager.rb +46 -0
  44. data/lib/karafka/connection/raw_messages_buffer.rb +101 -0
  45. data/lib/karafka/connection/rebalance_manager.rb +78 -0
  46. data/lib/karafka/contracts/base.rb +17 -0
  47. data/lib/karafka/contracts/config.rb +88 -11
  48. data/lib/karafka/contracts/consumer_group.rb +21 -184
  49. data/lib/karafka/contracts/consumer_group_topic.rb +35 -11
  50. data/lib/karafka/contracts/server_cli_options.rb +19 -18
  51. data/lib/karafka/contracts.rb +1 -1
  52. data/lib/karafka/env.rb +46 -0
  53. data/lib/karafka/errors.rb +21 -21
  54. data/lib/karafka/helpers/async.rb +33 -0
  55. data/lib/karafka/helpers/colorize.rb +20 -0
  56. data/lib/karafka/helpers/multi_delegator.rb +2 -2
  57. data/lib/karafka/instrumentation/callbacks/error.rb +40 -0
  58. data/lib/karafka/instrumentation/callbacks/statistics.rb +41 -0
  59. data/lib/karafka/instrumentation/logger.rb +6 -10
  60. data/lib/karafka/instrumentation/logger_listener.rb +174 -0
  61. data/lib/karafka/instrumentation/monitor.rb +13 -61
  62. data/lib/karafka/instrumentation/notifications.rb +53 -0
  63. data/lib/karafka/instrumentation/proctitle_listener.rb +3 -3
  64. data/lib/karafka/instrumentation/vendors/datadog/dashboard.json +1 -0
  65. data/lib/karafka/instrumentation/vendors/datadog/listener.rb +232 -0
  66. data/lib/karafka/instrumentation.rb +21 -0
  67. data/lib/karafka/licenser.rb +75 -0
  68. data/lib/karafka/messages/batch_metadata.rb +45 -0
  69. data/lib/karafka/messages/builders/batch_metadata.rb +39 -0
  70. data/lib/karafka/messages/builders/message.rb +39 -0
  71. data/lib/karafka/messages/builders/messages.rb +34 -0
  72. data/lib/karafka/{params/params.rb → messages/message.rb} +7 -12
  73. data/lib/karafka/messages/messages.rb +64 -0
  74. data/lib/karafka/{params → messages}/metadata.rb +4 -6
  75. data/lib/karafka/messages/seek.rb +9 -0
  76. data/lib/karafka/patches/rdkafka/consumer.rb +22 -0
  77. data/lib/karafka/pro/active_job/consumer.rb +46 -0
  78. data/lib/karafka/pro/active_job/dispatcher.rb +61 -0
  79. data/lib/karafka/pro/active_job/job_options_contract.rb +32 -0
  80. data/lib/karafka/pro/base_consumer.rb +107 -0
  81. data/lib/karafka/pro/contracts/base.rb +21 -0
  82. data/lib/karafka/pro/contracts/consumer_group.rb +34 -0
  83. data/lib/karafka/pro/contracts/consumer_group_topic.rb +69 -0
  84. data/lib/karafka/pro/loader.rb +76 -0
  85. data/lib/karafka/pro/performance_tracker.rb +80 -0
  86. data/lib/karafka/pro/processing/coordinator.rb +85 -0
  87. data/lib/karafka/pro/processing/jobs/consume_non_blocking.rb +38 -0
  88. data/lib/karafka/pro/processing/jobs_builder.rb +32 -0
  89. data/lib/karafka/pro/processing/partitioner.rb +58 -0
  90. data/lib/karafka/pro/processing/scheduler.rb +56 -0
  91. data/lib/karafka/pro/routing/builder_extensions.rb +30 -0
  92. data/lib/karafka/pro/routing/topic_extensions.rb +74 -0
  93. data/lib/karafka/pro.rb +13 -0
  94. data/lib/karafka/process.rb +1 -0
  95. data/lib/karafka/processing/coordinator.rb +103 -0
  96. data/lib/karafka/processing/coordinators_buffer.rb +54 -0
  97. data/lib/karafka/processing/executor.rb +126 -0
  98. data/lib/karafka/processing/executors_buffer.rb +88 -0
  99. data/lib/karafka/processing/jobs/base.rb +55 -0
  100. data/lib/karafka/processing/jobs/consume.rb +47 -0
  101. data/lib/karafka/processing/jobs/revoked.rb +22 -0
  102. data/lib/karafka/processing/jobs/shutdown.rb +23 -0
  103. data/lib/karafka/processing/jobs_builder.rb +29 -0
  104. data/lib/karafka/processing/jobs_queue.rb +144 -0
  105. data/lib/karafka/processing/partitioner.rb +22 -0
  106. data/lib/karafka/processing/result.rb +37 -0
  107. data/lib/karafka/processing/scheduler.rb +22 -0
  108. data/lib/karafka/processing/worker.rb +91 -0
  109. data/lib/karafka/processing/workers_batch.rb +27 -0
  110. data/lib/karafka/railtie.rb +127 -0
  111. data/lib/karafka/routing/builder.rb +26 -23
  112. data/lib/karafka/routing/consumer_group.rb +37 -17
  113. data/lib/karafka/routing/consumer_mapper.rb +1 -2
  114. data/lib/karafka/routing/proxy.rb +9 -16
  115. data/lib/karafka/routing/router.rb +1 -1
  116. data/lib/karafka/routing/subscription_group.rb +53 -0
  117. data/lib/karafka/routing/subscription_groups_builder.rb +54 -0
  118. data/lib/karafka/routing/topic.rb +65 -24
  119. data/lib/karafka/routing/topics.rb +38 -0
  120. data/lib/karafka/runner.rb +51 -0
  121. data/lib/karafka/serialization/json/deserializer.rb +6 -15
  122. data/lib/karafka/server.rb +67 -26
  123. data/lib/karafka/setup/config.rb +153 -175
  124. data/lib/karafka/status.rb +14 -5
  125. data/lib/karafka/templates/example_consumer.rb.erb +16 -0
  126. data/lib/karafka/templates/karafka.rb.erb +17 -55
  127. data/lib/karafka/time_trackers/base.rb +19 -0
  128. data/lib/karafka/time_trackers/pause.rb +92 -0
  129. data/lib/karafka/time_trackers/poll.rb +65 -0
  130. data/lib/karafka/version.rb +1 -1
  131. data/lib/karafka.rb +46 -16
  132. data.tar.gz.sig +0 -0
  133. metadata +145 -171
  134. metadata.gz.sig +0 -0
  135. data/.github/FUNDING.yml +0 -3
  136. data/MIT-LICENCE +0 -18
  137. data/certs/mensfeld.pem +0 -25
  138. data/lib/karafka/attributes_map.rb +0 -62
  139. data/lib/karafka/backends/inline.rb +0 -16
  140. data/lib/karafka/base_responder.rb +0 -226
  141. data/lib/karafka/cli/flow.rb +0 -48
  142. data/lib/karafka/code_reloader.rb +0 -67
  143. data/lib/karafka/connection/api_adapter.rb +0 -161
  144. data/lib/karafka/connection/batch_delegator.rb +0 -55
  145. data/lib/karafka/connection/builder.rb +0 -18
  146. data/lib/karafka/connection/message_delegator.rb +0 -36
  147. data/lib/karafka/consumers/batch_metadata.rb +0 -10
  148. data/lib/karafka/consumers/callbacks.rb +0 -71
  149. data/lib/karafka/consumers/includer.rb +0 -64
  150. data/lib/karafka/consumers/responders.rb +0 -24
  151. data/lib/karafka/consumers/single_params.rb +0 -15
  152. data/lib/karafka/contracts/responder_usage.rb +0 -54
  153. data/lib/karafka/fetcher.rb +0 -42
  154. data/lib/karafka/helpers/class_matcher.rb +0 -88
  155. data/lib/karafka/helpers/config_retriever.rb +0 -46
  156. data/lib/karafka/helpers/inflector.rb +0 -26
  157. data/lib/karafka/instrumentation/stdout_listener.rb +0 -140
  158. data/lib/karafka/params/batch_metadata.rb +0 -26
  159. data/lib/karafka/params/builders/batch_metadata.rb +0 -30
  160. data/lib/karafka/params/builders/params.rb +0 -38
  161. data/lib/karafka/params/builders/params_batch.rb +0 -25
  162. data/lib/karafka/params/params_batch.rb +0 -60
  163. data/lib/karafka/patches/ruby_kafka.rb +0 -47
  164. data/lib/karafka/persistence/client.rb +0 -29
  165. data/lib/karafka/persistence/consumers.rb +0 -45
  166. data/lib/karafka/persistence/topics.rb +0 -48
  167. data/lib/karafka/responders/builder.rb +0 -36
  168. data/lib/karafka/responders/topic.rb +0 -55
  169. data/lib/karafka/routing/topic_mapper.rb +0 -53
  170. data/lib/karafka/serialization/json/serializer.rb +0 -31
  171. data/lib/karafka/setup/configurators/water_drop.rb +0 -36
  172. data/lib/karafka/templates/application_responder.rb.erb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45788f5dd509d8a61a1480ff5c1b41f89b683d2100e0dcedaf6e35e6ce3af447
4
- data.tar.gz: d5e5638fd2a83b91f78cf1f38d03bd2594fb562a0cc8ad6cf2e45f60e72cc692
3
+ metadata.gz: f78f7cb985880d9172961be96386a0ebd37735831915f0cb9b9b46c832d2e9a9
4
+ data.tar.gz: a7f5a27cb3a6f0fa5185f32e5df7615f8a6013ef0018c85fb16c87de346f9362
5
5
  SHA512:
6
- metadata.gz: 75b2863022df6dc78f23ca557450a9757e137d110f9a6c49a29f572cd701863143e638394c341e8f982bdce4255df923879c8410ce081503c43e3f9a0ce2e777
7
- data.tar.gz: ec0eee525c34634d15b04c85a492e329d4749f179ff2c21d3ce2e50cccb4b6d061465c13df322a026b8924974f743277448464db818e13d73ef90f5ce930f796
6
+ metadata.gz: 5b6fed517f69a2bd84b16e82d266251dd4b7564d52f466745f3a93be9106f866ec658581c38b1a0913dd9e126a17cf4b1f5e85c888447c6e1e4b790453e7c87e
7
+ data.tar.gz: 25cfa154028dd12519d7d4b72606242a4058c9fabd1655ba727a9d73a905a942cd80374e2f7357f410a098b74b623966fa840b1c6725f71d630bf3ce92db187e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,52 +1,123 @@
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 * * *'
7
10
 
11
+ env:
12
+ BUNDLE_RETRY: 6
13
+ BUNDLE_JOBS: 4
14
+
8
15
  jobs:
16
+ diffend:
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: 3.1
29
+ bundler-cache: true
30
+
31
+ - name: Install Diffend plugin
32
+ run: bundle plugin install diffend
33
+
34
+ - name: Bundle Secure
35
+ run: bundle secure
36
+
37
+ coditsu:
38
+ runs-on: ubuntu-latest
39
+ strategy:
40
+ fail-fast: false
41
+ steps:
42
+ - uses: actions/checkout@v2
43
+ with:
44
+ fetch-depth: 0
45
+ - name: Run Coditsu
46
+ run: \curl -sSL https://api.coditsu.io/run/ci | bash
47
+
9
48
  specs:
10
49
  runs-on: ubuntu-latest
50
+ needs: diffend
11
51
  strategy:
12
52
  fail-fast: false
13
53
  matrix:
14
54
  ruby:
55
+ - '3.1'
56
+ - '3.0'
15
57
  - '2.7'
16
- - '2.6'
17
- - '2.5'
18
58
  include:
19
- - ruby: '2.7'
59
+ - ruby: '3.1'
20
60
  coverage: 'true'
21
61
  steps:
22
62
  - uses: actions/checkout@v2
23
63
  - name: Install package dependencies
24
64
  run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
65
+
66
+ - name: Start Kafka with docker-compose
67
+ run: |
68
+ docker-compose up -d
69
+
25
70
  - name: Set up Ruby
26
71
  uses: ruby/setup-ruby@v1
27
72
  with:
28
73
  ruby-version: ${{matrix.ruby}}
29
- - name: Install latest bundler
30
- run: |
31
- gem install bundler --no-document
32
- bundle config set without 'tools benchmarks docs'
33
- - name: Bundle install
34
- run: |
35
- bundle config set without development
36
- bundle install --jobs 4 --retry 3
37
- - name: Run Kafka with docker-compose
38
- run: docker-compose up -d
39
- - name: Run all tests
74
+ bundler-cache: true
75
+
76
+ - name: Run all specs
40
77
  env:
41
78
  GITHUB_COVERAGE: ${{matrix.coverage}}
42
79
  run: bundle exec rspec
43
- coditsu:
80
+
81
+ integrations:
44
82
  runs-on: ubuntu-latest
83
+ needs: diffend
45
84
  strategy:
46
85
  fail-fast: false
86
+ matrix:
87
+ ruby:
88
+ - '3.1'
89
+ - '3.0'
90
+ - '2.7'
91
+ include:
92
+ - ruby: '3.1'
93
+ coverage: 'true'
47
94
  steps:
48
95
  - uses: actions/checkout@v2
96
+ - name: Install package dependencies
97
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
98
+
99
+ - name: Start Kafka with docker-compose
100
+ run: |
101
+ docker-compose up -d
102
+
103
+ - name: Set up Ruby
104
+ uses: ruby/setup-ruby@v1
49
105
  with:
50
- fetch-depth: 0
51
- - name: Run Coditsu
52
- run: \curl -sSL https://api.coditsu.io/run/ci | bash
106
+ ruby-version: ${{matrix.ruby}}
107
+
108
+ - name: Install latest Bundler
109
+ run: |
110
+ gem install bundler --no-document
111
+ gem update --system --no-document
112
+ bundle config set without 'tools benchmarks docs'
113
+
114
+ - name: Bundle install
115
+ run: |
116
+ bundle config set without development
117
+ bundle install
118
+
119
+ - name: Run integration tests
120
+ env:
121
+ KARAFKA_PRO_LICENSE_TOKEN: ${{ secrets.KARAFKA_PRO_LICENSE_TOKEN }}
122
+ GITHUB_COVERAGE: ${{matrix.coverage}}
123
+ run: bin/integrations
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.1
1
+ 3.1.2
data/CHANGELOG.md CHANGED
@@ -1,8 +1,372 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 2.0.10 (2022-09-23)
4
+ - Improve error recovery by delegating the recovery to the existing `librdkafka` instance.
5
+
6
+ ## 2.0.9 (2022-09-22)
7
+ - Fix Singleton not visible when used in PORO (#1034)
8
+ - Divide pristine specs into pristine and poro. Pristine will still have helpers loaded, poro will have nothing.
9
+ - Fix a case where `manual_offset_management` offset upon error is not reverted to the first message in a case where there were no markings as consumed at all for multiple batches.
10
+ - Implement small reliability improvements around marking as consumed.
11
+ - Introduce a config sanity check to make sure Virtual Partitions are not used with manual offset management.
12
+ - Fix a possibility of using `active_job_topic` with Virtual Partitions and manual offset management (ActiveJob still can use due to atomicity of jobs).
13
+ - Move seek offset ownership to the coordinator to allow Virtual Partitions further development.
14
+ - Improve client shutdown in specs.
15
+ - Do not reset client on network issue and rely on `librdkafka` to do so.
16
+ - Allow for nameless (anonymous) subscription groups (#1033)
17
+
18
+ ## 2.0.8 (2022-09-19)
19
+ - [Breaking change] Rename Virtual Partitions `concurrency` to `max_partitions` to avoid confusion (#1023).
20
+ - Allow for block based subscription groups management (#1030).
21
+
22
+ ## 2.0.7 (2022-09-05)
23
+ - [Breaking change] Redefine the Virtual Partitions routing DSL to accept concurrency
24
+ - Allow for `concurrency` setting in Virtual Partitions to extend or limit number of jobs per regular partition. This allows to make sure, we do not use all the threads on virtual partitions jobs
25
+ - Allow for creation of as many Virtual Partitions as needed, without taking global `concurrency` into consideration
26
+
27
+ ## 2.0.6 (2022-09-02)
28
+ - Improve client closing.
29
+ - Fix for: Multiple LRJ topics fetched concurrently block ability for LRJ to kick in (#1002)
30
+ - Introduce a pre-enqueue sync execution layer to prevent starvation cases for LRJ
31
+ - Close admin upon critical errors to prevent segmentation faults
32
+ - Add support for manual subscription group management (#852)
33
+
34
+ ## 2.0.5 (2022-08-23)
35
+ - Fix unnecessary double new line in the `karafka.rb` template for Ruby on Rails
36
+ - Fix a case where a manually paused partition would not be processed after rebalance (#988)
37
+ - Increase specs stability.
38
+ - Lower concurrency of execution of specs in Github CI.
39
+
40
+ ## 2.0.4 (2022-08-19)
41
+ - Fix hanging topic creation (#964)
42
+ - Fix conflict with other Rails loading libraries like `gruf` (#974)
43
+
44
+ ## 2.0.3 (2022-08-09)
45
+ - Update boot info on server startup.
46
+ - Update `karafka info` with more descriptive Ruby version info.
47
+ - Fix issue where when used with Rails in development, log would be too verbose.
48
+ - Fix issue where Zeitwerk with Rails would not load Pro components despite license being present.
49
+
50
+ ## 2.0.2 (2022-08-07)
51
+ - Bypass issue with Rails reload in development by releasing the connection (https://github.com/rails/rails/issues/44183).
52
+
53
+ ## 2.0.1 (2022-08-06)
54
+ - Provide `Karafka::Admin` for creation and destruction of topics and fetching cluster info.
55
+ - Update integration specs to always use one-time disposable topics.
56
+ - Remove no longer needed `wait_for_kafka` script.
57
+ - Add more integration specs for cover offset management upon errors.
58
+
59
+ ## 2.0.0 (2022-08-05)
60
+
61
+ This changelog describes changes between `1.4` and `2.0`. Please refer to appropriate release notes for changes between particular `rc` releases.
62
+
63
+ Karafka 2.0 is a **major** rewrite that brings many new things to the table but also removes specific concepts that happened not to be as good as I initially thought when I created them.
64
+
65
+ Please consider getting a Pro version if you want to **support** my work on the Karafka ecosystem!
66
+
67
+ For anyone worried that I will start converting regular features into Pro: This will **not** happen. Anything free and fully OSS in Karafka 1.4 will **forever** remain free. Most additions and improvements to the ecosystem are to its free parts. Any feature that is introduced as a free and open one will not become paid.
68
+
69
+ ### Additions
70
+
71
+ This section describes **new** things and concepts introduced with Karafka 2.0.
72
+
73
+ Karafka 2.0:
74
+
75
+ - Introduces multi-threaded support for [concurrent work](https://github.com/karafka/karafka/wiki/Concurrency-and-multithreading) consumption for separate partitions as well as for single partition work via [Virtual Partitions](https://github.com/karafka/karafka/wiki/Pro-Virtual-Partitions).
76
+ - Introduces [Active Job adapter](https://github.com/karafka/karafka/wiki/Active-Job) for using Karafka as a jobs backend with Ruby on Rails Active Job.
77
+ - Introduces fully automatic integration end-to-end [test suite](https://github.com/karafka/karafka/tree/master/spec/integrations) that checks any case I could imagine.
78
+ - Introduces [Virtual Partitions](https://github.com/karafka/karafka/wiki/Pro-Virtual-Partitions) for ability to parallelize work of a single partition.
79
+ - Introduces [Long-Running Jobs](https://github.com/karafka/karafka/wiki/Pro-Long-Running-Jobs) to allow for work that would otherwise exceed the `max.poll.interval.ms`.
80
+ - Introduces the [Enhanced Scheduler](https://github.com/karafka/karafka/wiki/Pro-Enhanced-Scheduler) that uses a non-preemptive LJF (Longest Job First) algorithm instead of a a FIFO (First-In, First-Out) one.
81
+ - Introduces [Enhanced Active Job adapter](https://github.com/karafka/karafka/wiki/Pro-Enhanced-Active-Job) that is optimized and allows for strong ordering of jobs and more.
82
+ - Introduces seamless [Ruby on Rails integration](https://github.com/karafka/karafka/wiki/Integrating-with-Ruby-on-Rails-and-other-frameworks) via `Rails::Railte` without need for any extra configuration.
83
+ - Provides `#revoked` [method](https://github.com/karafka/karafka/wiki/Consuming-messages#shutdown-and-partition-revocation-handlers) for taking actions upon topic revocation.
84
+ - Emits underlying async errors emitted from `librdkafka` via the standardized `error.occurred` [monitor channel](https://github.com/karafka/karafka/wiki/Error-handling-and-back-off-policy#error-tracking).
85
+ - Replaces `ruby-kafka` with `librdkafka` as an underlying driver.
86
+ - Introduces official [EOL policies](https://github.com/karafka/karafka/wiki/Versions-Lifecycle-and-EOL).
87
+ - Introduces [benchmarks](https://github.com/karafka/karafka/tree/master/spec/benchmarks) that can be used to profile Karafka.
88
+ - Introduces a requirement that the end user code **needs** to be [thread-safe](https://github.com/karafka/karafka/wiki/FAQ#does-karafka-require-gems-to-be-thread-safe).
89
+ - Introduces a [Pro subscription](https://github.com/karafka/karafka/wiki/Build-vs-Buy) with a [commercial license](https://github.com/karafka/karafka/blob/master/LICENSE-COMM) to fund further ecosystem development.
90
+
91
+ ### Deletions
92
+
93
+ This section describes things that are **no longer** part of the Karafka ecosystem.
94
+
95
+ Karafka 2.0:
96
+
97
+ - Removes topics mappers concept completely.
98
+ - Removes pidfiles support.
99
+ - Removes daemonization support.
100
+ - Removes support for using `sidekiq-backend` due to introduction of [multi-threading](https://github.com/karafka/karafka/wiki/Concurrency-and-multithreading).
101
+ - Removes the `Responders` concept in favour of WaterDrop producer usage.
102
+ - Removes completely all the callbacks in favour of finalizer method `#shutdown`.
103
+ - Removes single message consumption mode in favour of [documentation](https://github.com/karafka/karafka/wiki/Consuming-messages#one-at-a-time) on how to do it easily by yourself.
104
+
105
+ ### Changes
106
+
107
+ This section describes things that were **changed** in Karafka but are still present.
108
+
109
+ Karafka 2.0:
110
+
111
+ - Uses only instrumentation that comes from Karafka. This applies also to notifications coming natively from `librdkafka`. They are now piped through Karafka prior to being dispatched.
112
+ - Integrates WaterDrop `2.x` tightly with autoconfiguration inheritance and an option to redefine it.
113
+ - Integrates with the `karafka-testing` gem for RSpec that also has been updated.
114
+ - Updates `cli info` to reflect the `2.0` details.
115
+ - Stops validating `kafka` configuration beyond minimum as the rest is handled by `librdkafka`.
116
+ - No longer uses `dry-validation`.
117
+ - No longer uses `dry-monitor`.
118
+ - No longer uses `dry-configurable`.
119
+ - Lowers general external dependencies three **heavily**.
120
+ - Renames `Karafka::Params::BatchMetadata` to `Karafka::Messages::BatchMetadata`.
121
+ - Renames `Karafka::Params::Params` to `Karafka::Messages::Message`.
122
+ - Renames `#params_batch` in consumers to `#messages`.
123
+ - Renames `Karafka::Params::Metadata` to `Karafka::Messages::Metadata`.
124
+ - Renames `Karafka::Fetcher` to `Karafka::Runner` and align notifications key names.
125
+ - Renames `StdoutListener` to `LoggerListener`.
126
+ - Reorganizes [monitoring and logging](https://github.com/karafka/karafka/wiki/Monitoring-and-logging) to match new concepts.
127
+ - Notifies on fatal worker processing errors.
128
+ - Contains updated install templates for Rails and no-non Rails.
129
+ - Changes how the routing style (`0.5`) behaves. It now builds a single consumer group instead of one per topic.
130
+ - Introduces changes that will allow me to build full web-UI in the upcoming `2.1`.
131
+ - Contains updated example apps.
132
+ - Standardizes error hooks for all error reporting (`error.occurred`).
133
+ - Changes license to `LGPL-3.0`.
134
+ - Introduces a `karafka-core` dependency that contains common code used across the ecosystem.
135
+ - Contains updated [wiki](https://github.com/karafka/karafka/wiki) on everything I could think of.
136
+
137
+ ### What's ahead
138
+
139
+ Karafka 2.0 is just the beginning.
140
+
141
+ There are several things in the plan already for 2.1 and beyond, including a web dashboard, at-rest encryption, transactions support, and more.
142
+
143
+ ## 2.0.0.rc6 (2022-08-05)
144
+ - Update licenser to use a gem based approach based on `karafka-license`.
145
+ - Do not mark intermediate jobs as consumed when Karafka runs Enhanced Active Job with Virtual Partitions.
146
+ - Improve development experience by adding fast cluster state changes refresh (#944)
147
+ - Improve the license loading.
148
+
149
+ ## 2.0.0.rc5 (2022-08-01)
150
+ - Improve specs stability
151
+ - Improve forceful shutdown
152
+ - Add support for debug `TTIN` backtrace printing
153
+ - Fix a case where logger listener would not intercept `warn` level
154
+ - Require `rdkafka` >= `0.12`
155
+ - Replace statistics decorator with the one from `karafka-core`
156
+
157
+ ## 2.0.0.rc4 (2022-07-28)
158
+ - Remove `dry-monitor`
159
+ - Use `karafka-core`
160
+ - Improve forceful shutdown resources finalization
161
+ - Cache consumer client name
162
+
163
+ ## 2.0.0.rc3 (2022-07-26)
164
+ - Fix Pro partitioner hash function may not utilize all the threads (#907).
165
+ - Improve virtual partitions messages distribution.
166
+ - Add StatsD/DataDog optional monitoring listener + dashboard template.
167
+ - Validate that Pro consumer is always used for Pro subscription.
168
+ - Improve ActiveJob consumer shutdown behaviour.
169
+ - Change default `max_wait_time` to 1 second.
170
+ - Change default `max_messages` to 100 (#915).
171
+ - Move logger listener polling reporting level to debug when no messages (#916).
172
+ - Improve stability on aggressive rebalancing (multiple rebalances in a short period).
173
+ - Improve specs stability.
174
+ - Allow using `:key` and `:partition_key` for Enhanced Active Job partitioning.
175
+
176
+ ## 2.0.0.rc2 (2022-07-19)
177
+ - Fix `example_consumer.rb.erb` `#shutdown` and `#revoked` signatures to correct once.
178
+ - Improve the install user experience (print status and created files).
179
+ - Change default `max_wait_time` from 10s to 5s.
180
+ - Remove direct dependency on `dry-configurable` in favour of a home-brew.
181
+ - Remove direct dependency on `dry-validation` in favour of a home-brew.
182
+
183
+ ## 2.0.0-rc1 (2022-07-08)
184
+ - Extract consumption partitioner out of listener inline code.
185
+ - Introduce virtual partitioner concept for parallel processing of data from a single topic partition.
186
+ - Improve stability when there kafka internal errors occur while polling.
187
+ - Fix a case where we would resume a LRJ partition upon rebalance where we would reclaim the partition while job was still running.
188
+ - Do not revoke pauses for lost partitions. This will allow to un-pause reclaimed partitions when LRJ jobs are done.
189
+ - Fail integrations by default (unless configured otherwise) if any errors occur during Karafka server execution.
190
+
191
+ ## 2.0.0-beta5 (2022-07-05)
192
+ - Always resume processing of a revoked partition upon assignment.
193
+ - Improve specs stability.
194
+ - Fix a case where revocation job would be executed on partition for which we never did any work.
195
+ - Introduce a jobs group coordinator for easier jobs management.
196
+ - Improve stability of resuming paused partitions that were revoked and re-assigned.
197
+ - Optimize reaction time on partition ownership changes.
198
+ - Fix a bug where despite setting long max wait time, we would return messages prior to it while not reaching the desired max messages count.
199
+ - Add more integration specs related to polling limits.
200
+ - Remove auto-detection of re-assigned partitions upon rebalance as for too fast rebalances it could not be accurate enough. It would also mess up in case of rebalances that would happen right after a `#seek` was issued for a partition.
201
+ - Optimize the removal of pre-buffered lost partitions data.
202
+ - Always run `#revoked` when rebalance with revocation happens.
203
+ - Evict executors upon rebalance, to prevent race-conditions.
204
+ - Align topics names for integration specs.
205
+
206
+ ## 2.0.0-beta4 (2022-06-20)
207
+ - Rename job internal api methods from `#prepare` to `#before_call` and from `#teardown` to `#after_call` to abstract away jobs execution from any type of executors and consumers logic
208
+ - Remove ability of running `before_consume` and `after_consume` completely. Those should be for internal usage only.
209
+ - Reorganize how Pro consumer and Pro AJ consumers inherit.
210
+ - Require WaterDrop `2.3.1`.
211
+ - Add more integration specs for rebalancing and max poll exceeded.
212
+ - Move `revoked?` state from PRO to regular Karafka.
213
+ - Use return value of `mark_as_consumed!` and `mark_as_consumed` as indicator of partition ownership + use it to switch the ownership state.
214
+ - Do not remove rebalance manager upon client reset and recovery. This will allow us to keep the notion of lost partitions, so we can run revocation jobs for blocking jobs that exceeded the max poll interval.
215
+ - Run revocation jobs upon reaching max poll interval for blocking jobs.
216
+ - Early exit `poll` operation upon partition lost or max poll exceeded event.
217
+ - Always reset consumer instances on timeout exceeded.
218
+ - Wait for Kafka to create all the needed topics before running specs in CI.
219
+
220
+ ## 2.0.0-beta3 (2022-06-14)
221
+ - Jobs building responsibility extracted out of the listener code base.
222
+ - Fix a case where specs supervisor would try to kill no longer running process (#868)
223
+ - Fix an instable integration spec that could misbehave under load
224
+ - Commit offsets prior to pausing partitions to ensure that the latest offset is always committed
225
+ - Fix a case where consecutive CTRL+C (non-stop) would case an exception during forced shutdown
226
+ - Add missing `consumer.prepared.error` into `LoggerListener`
227
+ - Delegate partition resuming from the consumers to listeners threads.
228
+ - Add support for Long-Running Jobs (LRJ) for ActiveJob [PRO]
229
+ - Add support for Long-Running Jobs for consumers [PRO]
230
+ - Allow `active_job_topic` to accept a block for extra topic related settings
231
+ - Remove no longer needed logger threads
232
+ - Auto-adapt number of processes for integration specs based on the number of CPUs
233
+ - Introduce an integration spec runner that prints everything to stdout (better for development)
234
+ - Introduce extra integration specs for various ActiveJob usage scenarios
235
+ - Rename consumer method `#prepared` to `#prepare` to reflect better its use-case
236
+ - For test and dev raise an error when expired license key is used (never for non dev)
237
+ - Add worker related monitor events (`worker.process` and `worker.processed`)
238
+ - Update `LoggerListener` to include more useful information about processing and polling messages
239
+
240
+ ## 2.0.0-beta2 (2022-06-07)
241
+ - Abstract away notion of topics groups (until now it was just an array)
242
+ - Optimize how jobs queue is closed. Since we enqueue jobs only from the listeners, we can safely close jobs queue once listeners are done. By extracting this responsibility from listeners, we remove corner cases and race conditions. Note here: for non-blocking jobs we do wait for them to finish while running the `poll`. This ensures, that for async jobs that are long-living, we do not reach `max.poll.interval`.
243
+ - `Shutdown` jobs are executed in workers to align all the jobs behaviours.
244
+ - `Shutdown` jobs are always blocking.
245
+ - Notion of `ListenersBatch` was introduced similar to `WorkersBatch` to abstract this concept.
246
+ - Change default `shutdown_timeout` to be more than `max_wait_time` not to cause forced shutdown when no messages are being received from Kafka.
247
+ - Abstract away scheduling of revocation and shutdown jobs for both default and pro schedulers
248
+ - Introduce a second (internal) messages buffer to distinguish between raw messages buffer and karafka messages buffer
249
+ - Move messages and their metadata remap process to the listener thread to allow for their inline usage
250
+ - Change how we wait in the shutdown phase, so shutdown jobs can still use Kafka connection even if they run for a longer period of time. This will prevent us from being kicked out from the group early.
251
+ - Introduce validation that ensures, that `shutdown_timeout` is more than `max_wait_time`. This will prevent users from ending up with a config that could lead to frequent forceful shutdowns.
252
+
253
+ ## 2.0.0-beta1 (2022-05-22)
254
+ - Update the jobs queue blocking engine and allow for non-blocking jobs execution
255
+ - Provide `#prepared` hook that always runs before the fetching loop is unblocked
256
+ - [Pro] Introduce performance tracker for scheduling optimizer
257
+ - Provide ability to pause (`#pause`) and resume (`#resume`) given partitions from the consumers
258
+ - Small integration specs refactoring + specs for pausing scenarios
259
+
260
+ ## 2.0.0-alpha6 (2022-04-17)
261
+ - Fix a bug, where upon missing boot file and Rails, railtie would fail with a generic exception (#818)
262
+ - Fix an issue with parallel pristine specs colliding with each other during `bundle install` (#820)
263
+ - Replace `consumer.consume` with `consumer.consumed` event to match the behaviour
264
+ - Make sure, that offset committing happens before the `consumer.consumed` event is propagated
265
+ - Fix for failing when not installed (just a dependency) (#817)
266
+ - Evict messages from partitions that were lost upon rebalancing (#825)
267
+ - Do **not** run `#revoked` on partitions that were lost and assigned back upon rebalancing (#825)
268
+ - Remove potential duplicated that could occur upon rebalance with re-assigned partitions (#825)
269
+ - Optimize integration test suite additional consumers shutdown process (#828)
270
+ - Optimize messages eviction and duplicates removal on poll stopped due to lack of messages
271
+ - Add static group membership integration spec
272
+
273
+ ## 2.0.0-alpha5 (2022-04-03)
274
+ - Rename StdoutListener to LoggerListener (#811)
275
+
276
+ ## 2.0.0-alpha4 (2022-03-20)
277
+ - Rails support without ActiveJob queue adapter usage (#805)
278
+
279
+ ## 2.0.0-alpha3 (2022-03-16)
280
+ - Restore 'app.initialized' state and add notification on it
281
+ - Fix the installation flow for Rails and add integration tests for this scenario
282
+ - Add more integration tests covering some edge cases
283
+
284
+ ## 2.0.0-alpha2 (2022-02-19)
285
+ - Require `kafka` keys to be symbols
286
+ - [Pro] Added ActiveJob Pro adapter
287
+ - Small updates to the license and docs
288
+
289
+ ## 2.0.0-alpha1 (2022-01-30)
290
+ - Change license to `LGPL-3.0`
291
+ - [Pro] Introduce a Pro subscription
292
+ - Switch from `ruby-kafka` to `librdkafka` as an underlying driver
293
+ - Introduce fully automatic integration tests that go through the whole server lifecycle
294
+ - Integrate WaterDrop tightly with autoconfiguration inheritance and an option to redefine it
295
+ - Multi-threaded support for concurrent jobs consumption (when in separate topics and/or partitions)
296
+ - Introduce subscriptions groups concept for better resources management
297
+ - Remove completely all the callbacks in favour of finalizer method `#on_shutdown`
298
+ - Provide `on_revoked` method for taking actions upon topic revoke
299
+ - Remove single message consumption mode in favour of documentation on how to do it easily by yourself
300
+ - Provide sync and async offset management with async preferred
301
+ - Introduce seamless Ruby on Rails integration via `Rails::Railte`
302
+ - Update `cli info` to reflect the `2.0` details
303
+ - Remove responders in favour of WaterDrop `2.0` producer
304
+ - Remove pidfiles support
305
+ - Remove daemonization support
306
+ - Stop validating `kafka` configuration beyond minimum as it is handled by `librdkafka`
307
+ - Remove topics mappers concept
308
+ - Reorganize monitoring to match new concepts
309
+ - Notify on fatal worker processing errors
310
+ - Rename `Karafka::Params::BatchMetadata` to `Karafka::Messages::BatchMetadata`
311
+ - Rename `Karafka::Params::Params` to `Karafka::Messages::Message`
312
+ - Rename `#params_batch` in consumers to `#messages`
313
+ - Rename `Karafka::Params::Metadata` to `Karafka::Messages::Metadata`
314
+ - Allow for processing work of multiple consumer groups by the same worker poll
315
+ - Rename `Karafka::Fetcher` to `Karafka::Runner` and align notifications key names
316
+ - Update install templates
317
+ - `sidekiq-backend` is no longer supported
318
+ - `testing` gem for RSpec has been updated
319
+ - `WaterDrop` `2.1+` support
320
+ - Simple routing style (`0.5`) now builds a single consumer group instead of one per topic
321
+ - Example apps were updated
322
+ - Hook for underlying statistics emitted from librdkafka have been added
323
+ - Hook for underlying async errors emitted from librdkafka have been added
324
+ - ActiveJob Rails adapter
325
+ - Added benchmarks that can be used to profile Karafka
326
+ - Standardize error hook for all error reporting
327
+
328
+ ## 1.4.11 (2021-12-04)
329
+ - Source code metadata url added to the gemspec
330
+ - Gem bump
331
+
332
+ ## 1.4.10 (2021-10-30)
333
+ - update gems requirements in the gemspec (nijikon)
334
+
335
+ ## 1.4.9 (2021-09-29)
336
+ - fix `dry-configurable` deprecation warnings for default value as positional argument
337
+
338
+ ## 1.4.8 (2021-09-08)
339
+ - Allow 'rails' in Gemfile to enable rails-aware generator (rewritten)
340
+
341
+ ## 1.4.7 (2021-09-04)
342
+ - Update ruby-kafka to `1.4.0`
343
+ - Support for `resolve_seed_brokers` option (with Azdaroth)
344
+ - Set minimum `ruby-kafka` requirement to `1.3.0`
345
+
346
+ ## 1.4.6 (2021-08-05)
347
+ - #700 Fix Ruby 3 compatibility issues in Connection::Client#pause (MmKolodziej)
348
+
349
+ ## 1.4.5 (2021-06-16)
350
+ - Fixup logger checks for non-writeable logfile (ojab)
351
+ - #689 - Update the stdout initialization message for framework initialization
352
+
353
+ ## 1.4.4 (2021-04-19)
354
+ - Remove Ruby 2.5 support and update minimum Ruby requirement to 2.6
355
+ - Remove rake dependency
356
+
357
+ ## 1.4.3 (2021-03-24)
358
+ - Fixes for Ruby 3.0 compatibility
359
+
360
+ ## 1.4.2 (2021-02-16)
361
+ - Rescue Errno::EROFS in ensure_dir_exists (unasuke)
362
+
363
+ ## 1.4.1 (2020-12-04)
364
+ - Return non-zero exit code when printing usage
365
+ - Add support for :assignment_strategy for consumers
366
+
3
367
  ## 1.4.0 (2020-09-05)
4
368
  - Rename `Karafka::Params::Metadata` to `Karafka::Params::BatchMetadata`
5
- ` Rename consumer `#metadata` to `#batch_metadata`
369
+ - Rename consumer `#metadata` to `#batch_metadata`
6
370
  - Separate metadata (including Karafka native metadata) from the root of params (backwards compatibility preserved thanks to rabotyaga)
7
371
  - Remove metadata hash dependency
8
372
  - Remove params dependency on a hash in favour of PORO
data/CONTRIBUTING.md CHANGED
@@ -1,41 +1,32 @@
1
- # Contribute
1
+ # Contributing
2
2
 
3
3
  ## Introduction
4
4
 
5
- First, thank you for considering contributing to karafka! It's people like you that make the open source community such a great community! 😊
5
+ 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! 😊
6
6
 
7
7
  We welcome any type of contribution, not only code. You can help with:
8
8
  - **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
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
- - **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
-
13
- ## Your First Contribution
14
-
15
- Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
11
+ - **Code**: take a look at the [open issues](https://github.com/karafka/karafka/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.
16
12
 
17
13
  ## Submitting code
18
14
 
19
15
  Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
20
16
 
21
- ## Code review process
17
+ ### Code review process
22
18
 
23
19
  Each pull request must pass all the rspec specs and meet our quality requirements.
24
20
 
25
21
  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.
26
22
 
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)
23
+ ### Contributing to Pro components
30
24
 
31
- ## Questions
32
-
33
- If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
34
- You can also reach us at hello@karafka.opencollective.com.
25
+ All of Karafka components are open-source. However, the `Pro` components are licenses under `LICENSE-COMM`.
35
26
 
36
- ## Credits
27
+ By sending a pull request to the pro components, you are agreeing to transfer the copyright of your code to Maciej Mensfeld.
37
28
 
38
- ### Contributors
29
+ ## Questions
39
30
 
40
- Thank you to all the people who have already contributed to karafka!
41
- <a href="graphs/contributors"><img src="https://opencollective.com/karafka/contributors.svg?width=890" /></a>
31
+ If you have any questions, create an [issue](https://github.com/karafka/karafka/issues) (protip: do a quick search first to see if someone else didn't ask the same question before!).
32
+ You can also reach us at contact@karafka.io.
data/Gemfile CHANGED
@@ -6,6 +6,12 @@ plugin 'diffend'
6
6
 
7
7
  gemspec
8
8
 
9
+ # Karafka gem does not require this but we add it here so we can test the integration with
10
+ # ActiveJob much easier
11
+ group :integrations do
12
+ gem 'activejob'
13
+ end
14
+
9
15
  group :test do
10
16
  gem 'byebug'
11
17
  gem 'factory_bot'