karafka 1.2.13 → 1.3.1
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.tar.gz.sig +0 -0
- data/{.coditsu.yml → .coditsu/ci.yml} +1 -1
- data/.console_irbrc +1 -3
- data/.github/FUNDING.yml +3 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +4 -17
- data/CHANGELOG.md +68 -4
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +2 -5
- data/Gemfile.lock +68 -57
- data/README.md +10 -11
- data/bin/karafka +1 -1
- data/certs/mensfeld.pem +25 -0
- data/config/errors.yml +38 -5
- data/karafka.gemspec +13 -11
- data/lib/karafka.rb +7 -15
- data/lib/karafka/app.rb +14 -6
- data/lib/karafka/attributes_map.rb +4 -5
- data/lib/karafka/base_consumer.rb +19 -30
- data/lib/karafka/base_responder.rb +45 -27
- data/lib/karafka/cli.rb +1 -1
- data/lib/karafka/cli/console.rb +11 -9
- data/lib/karafka/cli/flow.rb +0 -1
- data/lib/karafka/cli/info.rb +3 -1
- data/lib/karafka/cli/install.rb +30 -6
- data/lib/karafka/cli/server.rb +11 -6
- data/lib/karafka/code_reloader.rb +67 -0
- data/lib/karafka/connection/api_adapter.rb +11 -4
- data/lib/karafka/connection/batch_delegator.rb +51 -0
- data/lib/karafka/connection/builder.rb +1 -1
- data/lib/karafka/connection/client.rb +30 -20
- data/lib/karafka/connection/listener.rb +24 -13
- data/lib/karafka/connection/message_delegator.rb +36 -0
- data/lib/karafka/consumers/callbacks.rb +32 -15
- data/lib/karafka/consumers/includer.rb +30 -18
- data/lib/karafka/consumers/metadata.rb +10 -0
- data/lib/karafka/consumers/responders.rb +2 -2
- data/lib/karafka/contracts.rb +10 -0
- data/lib/karafka/contracts/config.rb +21 -0
- data/lib/karafka/contracts/consumer_group.rb +206 -0
- data/lib/karafka/contracts/consumer_group_topic.rb +19 -0
- data/lib/karafka/contracts/responder_usage.rb +54 -0
- data/lib/karafka/contracts/server_cli_options.rb +29 -0
- data/lib/karafka/errors.rb +17 -16
- data/lib/karafka/fetcher.rb +28 -30
- data/lib/karafka/helpers/class_matcher.rb +5 -1
- data/lib/karafka/helpers/config_retriever.rb +1 -1
- data/lib/karafka/helpers/inflector.rb +26 -0
- data/lib/karafka/helpers/multi_delegator.rb +0 -1
- data/lib/karafka/instrumentation/logger.rb +9 -6
- data/lib/karafka/instrumentation/monitor.rb +15 -9
- data/lib/karafka/instrumentation/proctitle_listener.rb +36 -0
- data/lib/karafka/instrumentation/stdout_listener.rb +138 -0
- data/lib/karafka/params/builders/metadata.rb +33 -0
- data/lib/karafka/params/builders/params.rb +36 -0
- data/lib/karafka/params/builders/params_batch.rb +25 -0
- data/lib/karafka/params/metadata.rb +35 -0
- data/lib/karafka/params/params.rb +68 -0
- data/lib/karafka/params/params_batch.rb +35 -20
- data/lib/karafka/patches/ruby_kafka.rb +21 -8
- data/lib/karafka/persistence/client.rb +15 -11
- data/lib/karafka/persistence/{consumer.rb → consumers.rb} +20 -13
- data/lib/karafka/persistence/topics.rb +48 -0
- data/lib/karafka/process.rb +0 -2
- data/lib/karafka/responders/topic.rb +6 -8
- data/lib/karafka/routing/builder.rb +36 -8
- data/lib/karafka/routing/consumer_group.rb +1 -1
- data/lib/karafka/routing/consumer_mapper.rb +9 -9
- data/lib/karafka/routing/proxy.rb +10 -1
- data/lib/karafka/routing/topic.rb +5 -3
- data/lib/karafka/routing/topic_mapper.rb +16 -18
- data/lib/karafka/serialization/json/deserializer.rb +27 -0
- data/lib/karafka/serialization/json/serializer.rb +31 -0
- data/lib/karafka/server.rb +25 -27
- data/lib/karafka/setup/config.rb +63 -37
- data/lib/karafka/setup/configurators/water_drop.rb +7 -3
- data/lib/karafka/setup/dsl.rb +0 -1
- data/lib/karafka/status.rb +7 -3
- data/lib/karafka/templates/{application_consumer.rb.example → application_consumer.rb.erb} +2 -1
- data/lib/karafka/templates/{application_responder.rb.example → application_responder.rb.erb} +0 -0
- data/lib/karafka/templates/karafka.rb.erb +92 -0
- data/lib/karafka/version.rb +1 -1
- metadata +92 -59
- metadata.gz.sig +0 -0
- data/lib/karafka/callbacks.rb +0 -30
- data/lib/karafka/callbacks/config.rb +0 -22
- data/lib/karafka/callbacks/dsl.rb +0 -16
- data/lib/karafka/connection/delegator.rb +0 -46
- data/lib/karafka/instrumentation/listener.rb +0 -112
- data/lib/karafka/loader.rb +0 -28
- data/lib/karafka/params/dsl.rb +0 -158
- data/lib/karafka/parsers/json.rb +0 -38
- data/lib/karafka/patches/dry_configurable.rb +0 -33
- data/lib/karafka/persistence/topic.rb +0 -29
- data/lib/karafka/schemas/config.rb +0 -24
- data/lib/karafka/schemas/consumer_group.rb +0 -79
- data/lib/karafka/schemas/consumer_group_topic.rb +0 -18
- data/lib/karafka/schemas/responder_usage.rb +0 -39
- data/lib/karafka/schemas/server_cli_options.rb +0 -43
- data/lib/karafka/setup/configurators/base.rb +0 -29
- data/lib/karafka/setup/configurators/params.rb +0 -25
- data/lib/karafka/templates/karafka.rb.example +0 -54
data/lib/karafka/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -9,23 +9,35 @@ authors:
|
|
9
9
|
- Adam Gwozdowski
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
|
-
cert_chain:
|
13
|
-
|
12
|
+
cert_chain:
|
13
|
+
- |
|
14
|
+
-----BEGIN CERTIFICATE-----
|
15
|
+
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
16
|
+
ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMTkwNzMwMTQ1NDU0WhcNMjAwNzI5MTQ1
|
17
|
+
NDU0WjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
|
18
|
+
CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC9fCwtaHZG2SyyNXiH8r0QbJQx/xxl
|
19
|
+
dkvwWz9QGJO+O8rEx20FB1Ab+MVkfOscwIv5jWpmk1U9whzDPl1uFtIbgu+sk+Zb
|
20
|
+
uQlZyK/DPN6c+/BbBL+RryTBRyvkPLoCVwm7uxc/JZ1n4AI6eF4cCZ2ieZ9QgQbU
|
21
|
+
MQs2QPqs9hT50Ez/40GnOdadVfiDDGz+NME2C4ms0BriXwZ1tcRTfJIHe2xjIbbb
|
22
|
+
y5qRGfsLKcgMzvLQR24olixyX1MR0s4+Wveq3QL/gBhL4veUcv+UABJA8IJR0kyB
|
23
|
+
seHHutusiwZ1v3SjjjW1xLLrc2ARV0mgCb0WaK2T4iA3oFTGLh6Ydz8LNl31KQFv
|
24
|
+
94nRd8IhmJxrhQ6dQ/WT9IXoa5S9lfT5lPJeINemH4/6QPABzf9W2IZlCdI9wCdB
|
25
|
+
TBaw57MKneGAYZiKjw6OALSy2ltQUCl3RqFl3VP7n8uFy1U987Q5VIIQ3O1UUsQD
|
26
|
+
Oe/h+r7GUU4RSPKgPlrwvW9bD/UQ+zF51v8CAwEAAaN3MHUwCQYDVR0TBAIwADAL
|
27
|
+
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJNIBHdfEUD7TqHqIer2YhWaWhwcMB0GA1Ud
|
28
|
+
EQQWMBSBEm1hY2llakBtZW5zZmVsZC5wbDAdBgNVHRIEFjAUgRJtYWNpZWpAbWVu
|
29
|
+
c2ZlbGQucGwwDQYJKoZIhvcNAQELBQADggGBAKA4eqko6BTNhlysip6rfBkVTGri
|
30
|
+
ZXsL+kRb2hLvsQJS/kLyM21oMlu+LN0aPj3qEFR8mE/YeDD8rLAfruBRTltPNbR7
|
31
|
+
xA5eE1gkxY5LfExUtK3b2wPqfmo7mZgfcsMwfYg/tUXw1WpBCnrhAJodpGH6SXmp
|
32
|
+
A40qFUZst0vjiOoO+aTblIHPmMJXoZ3K42dTlNKlEiDKUWMRKSgpjjYGEYalFNWI
|
33
|
+
hHfCz2r8L2t+dYdMZg1JGbEkq4ADGsAA8ioZIpJd7V4hI17u5TCdi7X5wh/0gN0E
|
34
|
+
CgP+nLox3D+l2q0QuQEkayr+auFYkzTCkF+BmEk1D0Ru4mcf3F4CJvEmW4Pzbjqt
|
35
|
+
i1tsCWPtJ4E/UUKnKaWKqGbjrjHJ0MuShYzHkodox5IOiCXIQg+1+YSzfXUV6WEK
|
36
|
+
KJG/fhg1JV5vVDdVy6x+tv5SQ5ctU0feCsVfESi3rE3zRd+nvzE9HcZ5aXeL1UtJ
|
37
|
+
nT5Xrioegu2w1jPyVEgyZgTZC5rvD0nNS5sFNQ==
|
38
|
+
-----END CERTIFICATE-----
|
39
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
14
40
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: activesupport
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - ">="
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '4.0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '4.0'
|
29
41
|
- !ruby/object:Gem::Dependency
|
30
42
|
name: dry-configurable
|
31
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,16 +86,30 @@ dependencies:
|
|
74
86
|
requirements:
|
75
87
|
- - "~>"
|
76
88
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
89
|
+
version: '1.2'
|
78
90
|
type: :runtime
|
79
91
|
prerelease: false
|
80
92
|
version_requirements: !ruby/object:Gem::Requirement
|
81
93
|
requirements:
|
82
94
|
- - "~>"
|
83
95
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
96
|
+
version: '1.2'
|
85
97
|
- !ruby/object:Gem::Dependency
|
86
98
|
name: envlogic
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.1'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.1'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: irb
|
87
113
|
requirement: !ruby/object:Gem::Requirement
|
88
114
|
requirements:
|
89
115
|
- - "~>"
|
@@ -125,61 +151,61 @@ dependencies:
|
|
125
151
|
- !ruby/object:Gem::Version
|
126
152
|
version: '11.3'
|
127
153
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
154
|
+
name: ruby-kafka
|
129
155
|
requirement: !ruby/object:Gem::Requirement
|
130
156
|
requirements:
|
131
157
|
- - ">="
|
132
158
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
159
|
+
version: 0.7.8
|
134
160
|
type: :runtime
|
135
161
|
prerelease: false
|
136
162
|
version_requirements: !ruby/object:Gem::Requirement
|
137
163
|
requirements:
|
138
164
|
- - ">="
|
139
165
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
166
|
+
version: 0.7.8
|
141
167
|
- !ruby/object:Gem::Dependency
|
142
|
-
name:
|
168
|
+
name: thor
|
143
169
|
requirement: !ruby/object:Gem::Requirement
|
144
170
|
requirements:
|
145
|
-
- - "
|
171
|
+
- - "~>"
|
146
172
|
- !ruby/object:Gem::Version
|
147
|
-
version: '0.
|
173
|
+
version: '0.20'
|
148
174
|
type: :runtime
|
149
175
|
prerelease: false
|
150
176
|
version_requirements: !ruby/object:Gem::Requirement
|
151
177
|
requirements:
|
152
|
-
- - "
|
178
|
+
- - "~>"
|
153
179
|
- !ruby/object:Gem::Version
|
154
|
-
version: '0.
|
180
|
+
version: '0.20'
|
155
181
|
- !ruby/object:Gem::Dependency
|
156
|
-
name:
|
182
|
+
name: waterdrop
|
157
183
|
requirement: !ruby/object:Gem::Requirement
|
158
184
|
requirements:
|
159
185
|
- - "~>"
|
160
186
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
187
|
+
version: 1.3.0
|
162
188
|
type: :runtime
|
163
189
|
prerelease: false
|
164
190
|
version_requirements: !ruby/object:Gem::Requirement
|
165
191
|
requirements:
|
166
192
|
- - "~>"
|
167
193
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
194
|
+
version: 1.3.0
|
169
195
|
- !ruby/object:Gem::Dependency
|
170
|
-
name:
|
196
|
+
name: zeitwerk
|
171
197
|
requirement: !ruby/object:Gem::Requirement
|
172
198
|
requirements:
|
173
199
|
- - "~>"
|
174
200
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
201
|
+
version: '2.1'
|
176
202
|
type: :runtime
|
177
203
|
prerelease: false
|
178
204
|
version_requirements: !ruby/object:Gem::Requirement
|
179
205
|
requirements:
|
180
206
|
- - "~>"
|
181
207
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
208
|
+
version: '2.1'
|
183
209
|
description: Framework used to simplify Apache Kafka based Ruby applications development
|
184
210
|
email:
|
185
211
|
- maciej@coditsu.io
|
@@ -190,8 +216,11 @@ executables:
|
|
190
216
|
extensions: []
|
191
217
|
extra_rdoc_files: []
|
192
218
|
files:
|
193
|
-
- ".coditsu.yml"
|
219
|
+
- ".coditsu/ci.yml"
|
194
220
|
- ".console_irbrc"
|
221
|
+
- ".github/FUNDING.yml"
|
222
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
223
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
195
224
|
- ".gitignore"
|
196
225
|
- ".rspec"
|
197
226
|
- ".ruby-gemset"
|
@@ -205,6 +234,7 @@ files:
|
|
205
234
|
- MIT-LICENCE
|
206
235
|
- README.md
|
207
236
|
- bin/karafka
|
237
|
+
- certs/mensfeld.pem
|
208
238
|
- config/errors.yml
|
209
239
|
- karafka.gemspec
|
210
240
|
- lib/karafka.rb
|
@@ -213,9 +243,6 @@ files:
|
|
213
243
|
- lib/karafka/backends/inline.rb
|
214
244
|
- lib/karafka/base_consumer.rb
|
215
245
|
- lib/karafka/base_responder.rb
|
216
|
-
- lib/karafka/callbacks.rb
|
217
|
-
- lib/karafka/callbacks/config.rb
|
218
|
-
- lib/karafka/callbacks/dsl.rb
|
219
246
|
- lib/karafka/cli.rb
|
220
247
|
- lib/karafka/cli/base.rb
|
221
248
|
- lib/karafka/cli/console.rb
|
@@ -223,32 +250,44 @@ files:
|
|
223
250
|
- lib/karafka/cli/info.rb
|
224
251
|
- lib/karafka/cli/install.rb
|
225
252
|
- lib/karafka/cli/server.rb
|
253
|
+
- lib/karafka/code_reloader.rb
|
226
254
|
- lib/karafka/connection/api_adapter.rb
|
255
|
+
- lib/karafka/connection/batch_delegator.rb
|
227
256
|
- lib/karafka/connection/builder.rb
|
228
257
|
- lib/karafka/connection/client.rb
|
229
|
-
- lib/karafka/connection/delegator.rb
|
230
258
|
- lib/karafka/connection/listener.rb
|
259
|
+
- lib/karafka/connection/message_delegator.rb
|
231
260
|
- lib/karafka/consumers/callbacks.rb
|
232
261
|
- lib/karafka/consumers/includer.rb
|
262
|
+
- lib/karafka/consumers/metadata.rb
|
233
263
|
- lib/karafka/consumers/responders.rb
|
234
264
|
- lib/karafka/consumers/single_params.rb
|
265
|
+
- lib/karafka/contracts.rb
|
266
|
+
- lib/karafka/contracts/config.rb
|
267
|
+
- lib/karafka/contracts/consumer_group.rb
|
268
|
+
- lib/karafka/contracts/consumer_group_topic.rb
|
269
|
+
- lib/karafka/contracts/responder_usage.rb
|
270
|
+
- lib/karafka/contracts/server_cli_options.rb
|
235
271
|
- lib/karafka/errors.rb
|
236
272
|
- lib/karafka/fetcher.rb
|
237
273
|
- lib/karafka/helpers/class_matcher.rb
|
238
274
|
- lib/karafka/helpers/config_retriever.rb
|
275
|
+
- lib/karafka/helpers/inflector.rb
|
239
276
|
- lib/karafka/helpers/multi_delegator.rb
|
240
|
-
- lib/karafka/instrumentation/listener.rb
|
241
277
|
- lib/karafka/instrumentation/logger.rb
|
242
278
|
- lib/karafka/instrumentation/monitor.rb
|
243
|
-
- lib/karafka/
|
244
|
-
- lib/karafka/
|
279
|
+
- lib/karafka/instrumentation/proctitle_listener.rb
|
280
|
+
- lib/karafka/instrumentation/stdout_listener.rb
|
281
|
+
- lib/karafka/params/builders/metadata.rb
|
282
|
+
- lib/karafka/params/builders/params.rb
|
283
|
+
- lib/karafka/params/builders/params_batch.rb
|
284
|
+
- lib/karafka/params/metadata.rb
|
285
|
+
- lib/karafka/params/params.rb
|
245
286
|
- lib/karafka/params/params_batch.rb
|
246
|
-
- lib/karafka/parsers/json.rb
|
247
|
-
- lib/karafka/patches/dry_configurable.rb
|
248
287
|
- lib/karafka/patches/ruby_kafka.rb
|
249
288
|
- lib/karafka/persistence/client.rb
|
250
|
-
- lib/karafka/persistence/
|
251
|
-
- lib/karafka/persistence/
|
289
|
+
- lib/karafka/persistence/consumers.rb
|
290
|
+
- lib/karafka/persistence/topics.rb
|
252
291
|
- lib/karafka/process.rb
|
253
292
|
- lib/karafka/responders/builder.rb
|
254
293
|
- lib/karafka/responders/topic.rb
|
@@ -259,29 +298,23 @@ files:
|
|
259
298
|
- lib/karafka/routing/router.rb
|
260
299
|
- lib/karafka/routing/topic.rb
|
261
300
|
- lib/karafka/routing/topic_mapper.rb
|
262
|
-
- lib/karafka/
|
263
|
-
- lib/karafka/
|
264
|
-
- lib/karafka/schemas/consumer_group_topic.rb
|
265
|
-
- lib/karafka/schemas/responder_usage.rb
|
266
|
-
- lib/karafka/schemas/server_cli_options.rb
|
301
|
+
- lib/karafka/serialization/json/deserializer.rb
|
302
|
+
- lib/karafka/serialization/json/serializer.rb
|
267
303
|
- lib/karafka/server.rb
|
268
304
|
- lib/karafka/setup/config.rb
|
269
|
-
- lib/karafka/setup/configurators/base.rb
|
270
|
-
- lib/karafka/setup/configurators/params.rb
|
271
305
|
- lib/karafka/setup/configurators/water_drop.rb
|
272
306
|
- lib/karafka/setup/dsl.rb
|
273
307
|
- lib/karafka/status.rb
|
274
|
-
- lib/karafka/templates/application_consumer.rb.
|
275
|
-
- lib/karafka/templates/application_responder.rb.
|
276
|
-
- lib/karafka/templates/karafka.rb.
|
308
|
+
- lib/karafka/templates/application_consumer.rb.erb
|
309
|
+
- lib/karafka/templates/application_responder.rb.erb
|
310
|
+
- lib/karafka/templates/karafka.rb.erb
|
277
311
|
- lib/karafka/version.rb
|
278
312
|
- log/.gitkeep
|
279
313
|
homepage: https://github.com/karafka/karafka
|
280
314
|
licenses:
|
281
315
|
- MIT
|
282
316
|
metadata: {}
|
283
|
-
post_install_message:
|
284
|
-
ruby-kafka in your Gemfile to version '0.6.8':\ngem 'ruby-kafka', '~> 0.6.8'\n"
|
317
|
+
post_install_message:
|
285
318
|
rdoc_options: []
|
286
319
|
require_paths:
|
287
320
|
- lib
|
@@ -289,14 +322,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
322
|
requirements:
|
290
323
|
- - ">="
|
291
324
|
- !ruby/object:Gem::Version
|
292
|
-
version: 2.
|
325
|
+
version: 2.5.0
|
293
326
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
327
|
requirements:
|
295
328
|
- - ">="
|
296
329
|
- !ruby/object:Gem::Version
|
297
330
|
version: '0'
|
298
331
|
requirements: []
|
299
|
-
rubygems_version: 3.0.
|
332
|
+
rubygems_version: 3.0.3
|
300
333
|
signing_key:
|
301
334
|
specification_version: 4
|
302
335
|
summary: Ruby based framework for working with Apache Kafka
|
metadata.gz.sig
ADDED
Binary file
|
data/lib/karafka/callbacks.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Karafka
|
4
|
-
# Additional callbacks that are used to trigger some things in given places during the
|
5
|
-
# system lifecycle
|
6
|
-
# @note Those callbacks aren't the same as consumer callbacks as they are not related to the
|
7
|
-
# lifecycle of particular messages fetches but rather to the internal flow process.
|
8
|
-
# They cannot be defined on a consumer callback level because for some of those,
|
9
|
-
# there aren't consumers in the memory yet and/or they aren't per consumer thread
|
10
|
-
module Callbacks
|
11
|
-
# Types of system callbacks that we have that are not related to consumers
|
12
|
-
TYPES = %i[
|
13
|
-
after_init
|
14
|
-
before_fetch_loop
|
15
|
-
].freeze
|
16
|
-
|
17
|
-
class << self
|
18
|
-
TYPES.each do |callback_type|
|
19
|
-
# Executes given callbacks set at a given moment with provided arguments
|
20
|
-
define_method callback_type do |*args|
|
21
|
-
Karafka::App
|
22
|
-
.config
|
23
|
-
.callbacks
|
24
|
-
.send(callback_type)
|
25
|
-
.each { |callback| callback.call(*args) }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Karafka
|
4
|
-
module Callbacks
|
5
|
-
# Additional configuration required to store procs that we will execute upon callback trigger
|
6
|
-
module Config
|
7
|
-
# Builds up internal callback accumulators
|
8
|
-
# @param klass [Class] Class that we extend with callback config
|
9
|
-
def self.extended(klass)
|
10
|
-
# option internal [Hash] - optional - internal karafka configuration settings that should
|
11
|
-
# never be changed by users directly
|
12
|
-
klass.setting :callbacks do
|
13
|
-
Callbacks::TYPES.each do |callback_type|
|
14
|
-
# option [Array<Proc>] an array of blocks that will be executed at a given moment
|
15
|
-
# depending on the callback type
|
16
|
-
setting callback_type, []
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Karafka
|
4
|
-
module Callbacks
|
5
|
-
# App level dsl to define callbacks
|
6
|
-
module Dsl
|
7
|
-
Callbacks::TYPES.each do |callback_type|
|
8
|
-
# Allows us to define a block, that will be executed for a given moment
|
9
|
-
# @param [Block] block that should be executed after the initialization process
|
10
|
-
define_method callback_type do |&block|
|
11
|
-
config.callbacks.send(callback_type).push block
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Karafka
|
4
|
-
module Connection
|
5
|
-
# Class that delegates processing of messages for which we listen to a proper processor
|
6
|
-
module Delegator
|
7
|
-
class << self
|
8
|
-
# Delegates messages (does something with them)
|
9
|
-
# It will either schedule or run a proper processor action for messages
|
10
|
-
# @note This should be looped to obtain a constant delegating of new messages
|
11
|
-
# @note We catch all the errors here, to make sure that none failures
|
12
|
-
# for a given consumption will affect other consumed messages
|
13
|
-
# If we wouldn't catch it, it would propagate up until killing the thread
|
14
|
-
# @note It is a one huge method, because of performance reasons. It is much faster then
|
15
|
-
# using send or invoking additional methods
|
16
|
-
# @param group_id [String] group_id of a group from which a given message came
|
17
|
-
# @param kafka_messages [Array<Kafka::FetchedMessage>] raw messages fetched from kafka
|
18
|
-
def call(group_id, kafka_messages)
|
19
|
-
# @note We always get messages by topic and partition so we can take topic from the
|
20
|
-
# first one and it will be valid for all the messages
|
21
|
-
topic = Persistence::Topic.fetch(group_id, kafka_messages[0].topic)
|
22
|
-
consumer = Persistence::Consumer.fetch(topic, kafka_messages[0].partition)
|
23
|
-
|
24
|
-
Karafka.monitor.instrument(
|
25
|
-
'connection.delegator.call',
|
26
|
-
caller: self,
|
27
|
-
consumer: consumer,
|
28
|
-
kafka_messages: kafka_messages
|
29
|
-
) do
|
30
|
-
# Depending on a case (persisted or not) we might use new consumer instance per
|
31
|
-
# each batch, or use the same one for all of them (for implementing buffering, etc.)
|
32
|
-
if topic.batch_consuming
|
33
|
-
consumer.params_batch = kafka_messages
|
34
|
-
consumer.call
|
35
|
-
else
|
36
|
-
kafka_messages.each do |kafka_message|
|
37
|
-
consumer.params_batch = [kafka_message]
|
38
|
-
consumer.call
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Karafka
|
4
|
-
module Instrumentation
|
5
|
-
# Default listener that hooks up to our instrumentation and uses its events for logging
|
6
|
-
# It can be removed/replaced or anything without any harm to the Karafka app flow
|
7
|
-
module Listener
|
8
|
-
# Log levels that we use in this particular listener
|
9
|
-
USED_LOG_LEVELS = %i[
|
10
|
-
debug
|
11
|
-
info
|
12
|
-
error
|
13
|
-
fatal
|
14
|
-
].freeze
|
15
|
-
|
16
|
-
# Injects WaterDrop listener logger actions
|
17
|
-
extend WaterDrop::Instrumentation::Listener
|
18
|
-
|
19
|
-
class << self
|
20
|
-
# Logs details about incoming messages and with which consumer we will consume them
|
21
|
-
# @param event [Dry::Events::Event] event details including payload
|
22
|
-
def on_connection_delegator_call(event)
|
23
|
-
consumer = event[:consumer]
|
24
|
-
topic = consumer.topic.name
|
25
|
-
kafka_messages = event[:kafka_messages]
|
26
|
-
info "#{kafka_messages.count} messages on #{topic} topic delegated to #{consumer.class}"
|
27
|
-
end
|
28
|
-
|
29
|
-
# Logs details about each received message value parsing
|
30
|
-
# @param event [Dry::Events::Event] event details including payload
|
31
|
-
def on_params_params_parse(event)
|
32
|
-
# Keep in mind, that a caller here is a param object not a controller,
|
33
|
-
# so it returns a topic as a string, not a routing topic
|
34
|
-
debug "Params parsing for #{event[:caller].topic} topic successful in #{event[:time]} ms"
|
35
|
-
end
|
36
|
-
|
37
|
-
# Logs unsuccessful parsing attempts of incoming data
|
38
|
-
# @param event [Dry::Events::Event] event details including payload
|
39
|
-
def on_params_params_parse_error(event)
|
40
|
-
error "Params parsing error for #{event[:caller].topic} topic: #{event[:error]}"
|
41
|
-
end
|
42
|
-
|
43
|
-
# Logs errors that occured in a listener fetch loop
|
44
|
-
# @param event [Dry::Events::Event] event details including payload
|
45
|
-
# @note It's an error as we can recover from it not a fatal
|
46
|
-
def on_connection_listener_fetch_loop_error(event)
|
47
|
-
error "Listener fetch loop error: #{event[:error]}"
|
48
|
-
end
|
49
|
-
|
50
|
-
# Logs errors that are related to the connection itself
|
51
|
-
# @note Karafka will attempt to reconnect, so an error not a fatal
|
52
|
-
# @param event [Dry::Events::Event] event details including payload
|
53
|
-
def on_connection_client_fetch_loop_error(event)
|
54
|
-
error "Client fetch loop error: #{event[:error]}"
|
55
|
-
end
|
56
|
-
|
57
|
-
# Logs info about crashed fetcher
|
58
|
-
# @note If this happens, Karafka will shutdown as it means a critical error
|
59
|
-
# in one of the threads
|
60
|
-
# @param event [Dry::Events::Event] event details including payload
|
61
|
-
def on_fetcher_call_error(event)
|
62
|
-
fatal "Fetcher crash due to an error: #{event[:error]}"
|
63
|
-
end
|
64
|
-
|
65
|
-
# Logs info about processing of a certain dataset with an inline backend
|
66
|
-
# @param event [Dry::Events::Event] event details including payload
|
67
|
-
def on_backends_inline_process(event)
|
68
|
-
count = event[:caller].send(:params_batch).to_a.size
|
69
|
-
topic = event[:caller].topic.name
|
70
|
-
time = event[:time]
|
71
|
-
info "Inline processing of topic #{topic} with #{count} messages took #{time} ms"
|
72
|
-
end
|
73
|
-
|
74
|
-
# Logs info about system signals that Karafka received
|
75
|
-
# @param event [Dry::Events::Event] event details including payload
|
76
|
-
def on_process_notice_signal(event)
|
77
|
-
info "Received #{event[:signal]} system signal"
|
78
|
-
end
|
79
|
-
|
80
|
-
# Logs info about responder usage withing a controller flow
|
81
|
-
# @param event [Dry::Events::Event] event details including payload
|
82
|
-
def on_consumers_responders_respond_with(event)
|
83
|
-
calling = event[:caller].class
|
84
|
-
responder = calling.topic.responder
|
85
|
-
data = event[:data]
|
86
|
-
info "Responded from #{calling} using #{responder} with following data #{data}"
|
87
|
-
end
|
88
|
-
|
89
|
-
# Logs info that we're going to stop the Karafka server
|
90
|
-
# @param _event [Dry::Events::Event] event details including payload
|
91
|
-
def on_server_stop(_event)
|
92
|
-
# We use a separate thread as logging can't be called from trap context
|
93
|
-
Thread.new { info "Stopping Karafka server #{::Process.pid}" }
|
94
|
-
end
|
95
|
-
|
96
|
-
# Logs an error that Karafka was unable to stop the server gracefully and it had to do a
|
97
|
-
# forced exit
|
98
|
-
# @param _event [Dry::Events::Event] event details including payload
|
99
|
-
def on_server_stop_error(_event)
|
100
|
-
# We use a separate thread as logging can't be called from trap context
|
101
|
-
Thread.new { error "Forceful Karafka server #{::Process.pid} stop" }
|
102
|
-
end
|
103
|
-
|
104
|
-
USED_LOG_LEVELS.each do |log_level|
|
105
|
-
define_method log_level do |*args|
|
106
|
-
Karafka.logger.send(log_level, *args)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|