karafka 2.0.0.rc5 → 2.0.0.rc6
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/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/LICENSE-COMM +2 -2
- data/README.md +3 -3
- data/bin/create_token +1 -7
- data/bin/integrations +1 -1
- data/lib/karafka/cli/info.rb +1 -2
- data/lib/karafka/connection/client.rb +6 -1
- data/lib/karafka/contracts/config.rb +0 -1
- data/lib/karafka/instrumentation/proctitle_listener.rb +3 -3
- data/lib/karafka/instrumentation/vendors/datadog/listener.rb +8 -8
- data/lib/karafka/licenser.rb +28 -48
- data/lib/karafka/pro/active_job/consumer.rb +4 -0
- data/lib/karafka/pro/loader.rb +1 -1
- data/lib/karafka/pro/performance_tracker.rb +1 -1
- data/lib/karafka/pro/processing/coordinator.rb +9 -0
- data/lib/karafka/setup/config.rb +27 -6
- data/lib/karafka/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13fbbd2c70987d84f768acb1a01f02f18ca59f49d8f02a2c1103b6870dbcfb15
|
4
|
+
data.tar.gz: 223187a692ae8e3d5da3c028c135c20a3de0c05b26b7f67cfbae11b928b02773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381ddd6a4d3f9695ca5d657d4960213afb3c5b92b8b4e0f51b45f75d1de92f65a570ec903abb43d5cb2cf371a557dbbb01cb78ce33eb118902e6d5e77fdb6095
|
7
|
+
data.tar.gz: e4675ba160b9443240497f874e29bb7614b77bf06c4fa8e768aff42060de182059ac4a26b07841d251f5bb4d257ad8f3920d77ec551c8f1487a4eef3e6a6db32
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Karafka framework changelog
|
2
2
|
|
3
|
+
## 2.0.0.rc6 (2022-08-05)
|
4
|
+
- Update licenser to use a gem based approach based on `karafka/pro/license`.
|
5
|
+
- Do not mark intermediate jobs as consumed when Karafka runs Enhanced Active Job with Virtual Partitions.
|
6
|
+
- Improve development experience by adding fast cluster state changes refresh (#944)
|
7
|
+
- Improve the license loading.
|
8
|
+
|
3
9
|
## 2.0.0.rc5 (2022-08-01)
|
4
10
|
- Improve specs stability
|
5
11
|
- Improve forceful shutdown
|
data/Gemfile.lock
CHANGED
data/LICENSE-COMM
CHANGED
@@ -6,7 +6,7 @@ IMPORTANT: THIS SOFTWARE END-USER LICENSE AGREEMENT ("EULA") IS A LEGAL AGREEMEN
|
|
6
6
|
|
7
7
|
------------------------------------------------------------------------------
|
8
8
|
|
9
|
-
In order to use the Software under this Agreement, you must receive
|
9
|
+
In order to use the Software under this Agreement, you must receive a "Source URL" to a license package at the time of purchase, in accordance with the scope of use and other terms specified for each type of Software and as set forth in this Section 1 of this Agreement.
|
10
10
|
|
11
11
|
1. License Grant
|
12
12
|
|
@@ -22,7 +22,7 @@ In order to use the Software under this Agreement, you must receive an applicati
|
|
22
22
|
|
23
23
|
3. Restricted Uses.
|
24
24
|
|
25
|
-
3.1 You shall not (and shall not allow any third party to): (a) decompile, disassemble, or otherwise reverse engineer the Software or attempt to reconstruct or discover any source code, underlying ideas, algorithms, file formats or programming interfaces of the Software by any means whatsoever (except and only to the extent that applicable law prohibits or restricts reverse engineering restrictions); (b) distribute, sell, sublicense, rent, lease or use the Software for time sharing, hosting, service provider or like purposes, except as expressly permitted under this Agreement; (c) redistribute the Software or Modifications other than by including the Software or a portion thereof within your own product, which must have substantially different functionality than the Software or Modifications and must not allow any third party to use the Software or Modifications, or any portions thereof, for software development or application development purposes; (d) redistribute the Software as part of a product, "appliance" or "virtual server"; (e) redistribute the Software on any server which is not directly under your control; (f) remove any product identification, proprietary, copyright or other notices contained in the Software; (g) modify any part of the Software, create a derivative work of any part of the Software (except as permitted in Section 4), or incorporate the Software, except to the extent expressly authorized in writing by Maciej Mensfeld; (h) publicly disseminate performance information or analysis (including, without limitation, benchmarks) from any source relating to the Software; (i) utilize any equipment, device, software, or other means designed to circumvent or remove any form of
|
25
|
+
3.1 You shall not (and shall not allow any third party to): (a) decompile, disassemble, or otherwise reverse engineer the Software or attempt to reconstruct or discover any source code, underlying ideas, algorithms, file formats or programming interfaces of the Software by any means whatsoever (except and only to the extent that applicable law prohibits or restricts reverse engineering restrictions); (b) distribute, sell, sublicense, rent, lease or use the Software for time sharing, hosting, service provider or like purposes, except as expressly permitted under this Agreement; (c) redistribute the Software or Modifications other than by including the Software or a portion thereof within your own product, which must have substantially different functionality than the Software or Modifications and must not allow any third party to use the Software or Modifications, or any portions thereof, for software development or application development purposes; (d) redistribute the Software as part of a product, "appliance" or "virtual server"; (e) redistribute the Software on any server which is not directly under your control; (f) remove any product identification, proprietary, copyright or other notices contained in the Software; (g) modify any part of the Software, create a derivative work of any part of the Software (except as permitted in Section 4), or incorporate the Software, except to the extent expressly authorized in writing by Maciej Mensfeld; (h) publicly disseminate performance information or analysis (including, without limitation, benchmarks) from any source relating to the Software; (i) utilize any equipment, device, software, or other means designed to circumvent or remove any form of Source URL or copy protection used by Maciej Mensfeld in connection with the Software, or use the Software together with any authorization code, Source URL, serial number, or other copy protection device not supplied by Maciej Mensfeld; (j) use the Software to develop a product which is competitive with any Maciej Mensfeld product offerings; or (k) use unauthorized Source URLS or keycode(s) or distribute or publish Source URLs or keycode(s), except as may be expressly permitted by Maciej Mensfeld in writing. If your unique Source URL is ever published, Maciej Mensfeld reserves the right to terminate your access without notice.
|
26
26
|
|
27
27
|
3.2 UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE AS PART OF A PRODUCT OR SERVICE THAT PROVIDES SIMILAR FUNCTIONALITY TO THE SOFTWARE ITSELF.
|
28
28
|
|
data/README.md
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/karafka.svg)](http://badge.fury.io/rb/karafka)
|
5
5
|
[![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)
|
6
6
|
|
7
|
-
**Note**: All of the documentation here refers to Karafka `2.0.0.
|
7
|
+
**Note**: All of the documentation here refers to Karafka `2.0.0.rc5` or higher. If you are looking for the documentation for Karafka `1.4`, please click [here](https://github.com/karafka/wiki/tree/1.4).
|
8
8
|
|
9
9
|
## About Karafka
|
10
10
|
|
11
11
|
Karafka is a Ruby and Rails multi-threaded efficient Kafka processing framework that:
|
12
12
|
|
13
13
|
- Supports parallel processing in [multiple threads](https://github.com/karafka/karafka/wiki/Concurrency-and-multithreading) (also for a [single topic partition](https://github.com/karafka/karafka/wiki/Pro-Virtual-Partitions) work)
|
14
|
-
- Has [ActiveJob backend](https://github.com/karafka/karafka/wiki/Active-Job) support (including ordered jobs)
|
14
|
+
- Has [ActiveJob backend](https://github.com/karafka/karafka/wiki/Active-Job) support (including [ordered jobs](https://github.com/karafka/karafka/wiki/Pro-Enhanced-Active-Job#ordered-jobs))
|
15
15
|
- [Automatically integrates](https://github.com/karafka/karafka/wiki/Integrating-with-Ruby-on-Rails-and-other-frameworks#integrating-with-ruby-on-rails=) with Ruby on Rails
|
16
16
|
- Supports in-development [code reloading](https://github.com/karafka/karafka/wiki/Auto-reload-of-code-changes-in-development)
|
17
17
|
- Is powered by [librdkafka](https://github.com/edenhill/librdkafka) (the Apache Kafka C/C++ client library)
|
@@ -55,7 +55,7 @@ We also maintain many [integration specs](https://github.com/karafka/karafka/tre
|
|
55
55
|
1. Add and install Karafka:
|
56
56
|
|
57
57
|
```bash
|
58
|
-
bundle add karafka -v 2.0.0.
|
58
|
+
bundle add karafka -v 2.0.0.rc5
|
59
59
|
|
60
60
|
bundle exec karafka install
|
61
61
|
```
|
data/bin/create_token
CHANGED
@@ -9,16 +9,10 @@ PRIVATE_KEY_LOCATION = File.join(Dir.home, '.ssh', 'karafka-pro', 'id_rsa')
|
|
9
9
|
|
10
10
|
# Name of the entity that acquires the license
|
11
11
|
ENTITY = ARGV[0]
|
12
|
-
# Date till which license is valid
|
13
|
-
EXPIRES_ON = Date.parse(ARGV[1])
|
14
12
|
|
15
13
|
raise ArgumentError, 'Entity missing' if ENTITY.nil? || ENTITY.empty?
|
16
|
-
raise ArgumentError, 'Expires on needs to be in the future' if EXPIRES_ON <= Date.today
|
17
14
|
|
18
|
-
pro_token_data = {
|
19
|
-
entity: ENTITY,
|
20
|
-
expires_on: EXPIRES_ON
|
21
|
-
}
|
15
|
+
pro_token_data = { entity: ENTITY }
|
22
16
|
|
23
17
|
# This code uses my private key to generate a new token for Karafka Pro capabilities
|
24
18
|
private_key = OpenSSL::PKey::RSA.new(File.read(PRIVATE_KEY_LOCATION))
|
data/bin/integrations
CHANGED
@@ -22,7 +22,7 @@ ROOT_PATH = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '../
|
|
22
22
|
CONCURRENCY = ENV.key?('CI') ? 5 : Etc.nprocessors * 2
|
23
23
|
|
24
24
|
# How may bytes do we want to keep from the stdout in the buffer for when we need to print it
|
25
|
-
MAX_BUFFER_OUTPUT =
|
25
|
+
MAX_BUFFER_OUTPUT = 51_200
|
26
26
|
|
27
27
|
# Abstraction around a single test scenario execution process
|
28
28
|
class Scenario
|
data/lib/karafka/cli/info.rb
CHANGED
@@ -345,6 +345,9 @@ module Karafka
|
|
345
345
|
when :network_exception # 13
|
346
346
|
reset
|
347
347
|
return nil
|
348
|
+
when :unknown_topic_or_part
|
349
|
+
# This is expected and temporary until rdkafka catches up with metadata
|
350
|
+
return nil
|
348
351
|
end
|
349
352
|
|
350
353
|
raise if time_poll.attempts > MAX_POLL_RETRIES
|
@@ -364,7 +367,6 @@ module Karafka
|
|
364
367
|
config = ::Rdkafka::Config.new(@subscription_group.kafka)
|
365
368
|
config.consumer_rebalance_listener = @rebalance_manager
|
366
369
|
consumer = config.consumer
|
367
|
-
consumer.subscribe(*@subscription_group.topics.map(&:name))
|
368
370
|
@name = consumer.name
|
369
371
|
|
370
372
|
# Register statistics runner for this particular type of callbacks
|
@@ -389,6 +391,9 @@ module Karafka
|
|
389
391
|
)
|
390
392
|
)
|
391
393
|
|
394
|
+
# Subscription needs to happen after we assigned the rebalance callbacks just in case of
|
395
|
+
# a race condition
|
396
|
+
consumer.subscribe(*@subscription_group.topics.map(&:name))
|
392
397
|
consumer
|
393
398
|
end
|
394
399
|
|
@@ -21,7 +21,6 @@ module Karafka
|
|
21
21
|
nested(:license) do
|
22
22
|
required(:token) { |val| [true, false].include?(val) || val.is_a?(String) }
|
23
23
|
required(:entity) { |val| val.is_a?(String) }
|
24
|
-
required(:expires_on) { |val| val.is_a?(Date) }
|
25
24
|
end
|
26
25
|
|
27
26
|
required(:client_id) { |val| val.is_a?(String) && Contracts::TOPIC_REGEXP.match?(val) }
|
@@ -5,19 +5,19 @@ module Karafka
|
|
5
5
|
# Listener that sets a proc title with a nice descriptive value
|
6
6
|
class ProctitleListener
|
7
7
|
# Updates proc title to an initializing one
|
8
|
-
# @param _event [
|
8
|
+
# @param _event [Karafka::Core::Monitoring::Event] event details including payload
|
9
9
|
def on_app_initializing(_event)
|
10
10
|
setproctitle('initializing')
|
11
11
|
end
|
12
12
|
|
13
13
|
# Updates proc title to a running one
|
14
|
-
# @param _event [
|
14
|
+
# @param _event [Karafka::Core::Monitoring::Event] event details including payload
|
15
15
|
def on_app_running(_event)
|
16
16
|
setproctitle('running')
|
17
17
|
end
|
18
18
|
|
19
19
|
# Updates proc title to a stopping one
|
20
|
-
# @param _event [
|
20
|
+
# @param _event [Karafka::Core::Monitoring::Event] event details including payload
|
21
21
|
def on_app_stopping(_event)
|
22
22
|
setproctitle('stopping')
|
23
23
|
end
|
@@ -65,7 +65,7 @@ module Karafka
|
|
65
65
|
|
66
66
|
# Hooks up to WaterDrop instrumentation for emitted statistics
|
67
67
|
#
|
68
|
-
# @param event [
|
68
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
69
69
|
def on_statistics_emitted(event)
|
70
70
|
statistics = event[:statistics]
|
71
71
|
|
@@ -76,7 +76,7 @@ module Karafka
|
|
76
76
|
|
77
77
|
# Increases the errors count by 1
|
78
78
|
#
|
79
|
-
# @param event [
|
79
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
80
80
|
def on_error_occurred(event)
|
81
81
|
extra_tags = ["type:#{event[:type]}"]
|
82
82
|
|
@@ -94,7 +94,7 @@ module Karafka
|
|
94
94
|
|
95
95
|
# Reports how many messages we've polled and how much time did we spend on it
|
96
96
|
#
|
97
|
-
# @param event [
|
97
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
98
98
|
def on_connection_listener_fetch_loop_received(event)
|
99
99
|
time_taken = event[:time]
|
100
100
|
messages_count = event[:messages_buffer].size
|
@@ -105,7 +105,7 @@ module Karafka
|
|
105
105
|
|
106
106
|
# Here we report majority of things related to processing as we have access to the
|
107
107
|
# consumer
|
108
|
-
# @param event [
|
108
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
109
109
|
def on_consumer_consumed(event)
|
110
110
|
messages = event.payload[:caller].messages
|
111
111
|
metadata = messages.metadata
|
@@ -124,7 +124,7 @@ module Karafka
|
|
124
124
|
histogram('consumer.consumption_lag', metadata.consumption_lag, tags: tags)
|
125
125
|
end
|
126
126
|
|
127
|
-
# @param event [
|
127
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
128
128
|
def on_consumer_revoked(event)
|
129
129
|
messages = event.payload[:caller].messages
|
130
130
|
metadata = messages.metadata
|
@@ -137,7 +137,7 @@ module Karafka
|
|
137
137
|
count('consumer.revoked', 1, tags: tags)
|
138
138
|
end
|
139
139
|
|
140
|
-
# @param event [
|
140
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
141
141
|
def on_consumer_shutdown(event)
|
142
142
|
messages = event.payload[:caller].messages
|
143
143
|
metadata = messages.metadata
|
@@ -151,7 +151,7 @@ module Karafka
|
|
151
151
|
end
|
152
152
|
|
153
153
|
# Worker related metrics
|
154
|
-
# @param event [
|
154
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
155
155
|
def on_worker_process(event)
|
156
156
|
jq_stats = event[:jobs_queue].statistics
|
157
157
|
|
@@ -162,7 +162,7 @@ module Karafka
|
|
162
162
|
|
163
163
|
# We report this metric before and after processing for higher accuracy
|
164
164
|
# Without this, the utilization would not be fully reflected
|
165
|
-
# @param event [
|
165
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
166
166
|
def on_worker_processed(event)
|
167
167
|
jq_stats = event[:jobs_queue].statistics
|
168
168
|
|
data/lib/karafka/licenser.rb
CHANGED
@@ -8,8 +8,34 @@ module Karafka
|
|
8
8
|
|
9
9
|
private_constant :PUBLIC_KEY_LOCATION
|
10
10
|
|
11
|
+
# Tries to prepare license and verifies it
|
12
|
+
#
|
13
|
+
# @param license_config [Karafka::Core::Configurable::Node] config related to the licensing
|
14
|
+
def prepare_and_verify(license_config)
|
15
|
+
prepare(license_config)
|
16
|
+
verify(license_config)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# @param license_config [Karafka::Core::Configurable::Node] config related to the licensing
|
22
|
+
def prepare(license_config)
|
23
|
+
# If there is token, no action needed
|
24
|
+
# We support a case where someone would put the token in instead of using one from the
|
25
|
+
# license. That's in case there are limitations to using external package sources, etc
|
26
|
+
return if license_config.token
|
27
|
+
|
28
|
+
begin
|
29
|
+
license_config.token || require('karafka-license')
|
30
|
+
rescue LoadError
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
34
|
+
license_config.token = Karafka::License.token
|
35
|
+
end
|
36
|
+
|
11
37
|
# Check license and setup license details (if needed)
|
12
|
-
# @param license_config [
|
38
|
+
# @param license_config [Karafka::Core::Configurable::Node] config related to the licensing
|
13
39
|
def verify(license_config)
|
14
40
|
# If no license, it will just run LGPL components without anything extra
|
15
41
|
return unless license_config.token
|
@@ -29,19 +55,10 @@ module Karafka
|
|
29
55
|
details = data ? JSON.parse(data) : raise_invalid_license_token(license_config)
|
30
56
|
|
31
57
|
license_config.entity = details.fetch('entity')
|
32
|
-
license_config.expires_on = Date.parse(details.fetch('expires_on'))
|
33
|
-
|
34
|
-
return if license_config.expires_on > Date.today
|
35
|
-
|
36
|
-
raise_expired_license_token_in_dev(license_config.expires_on)
|
37
|
-
|
38
|
-
notify_if_license_expired(license_config.expires_on)
|
39
58
|
end
|
40
59
|
|
41
|
-
private
|
42
|
-
|
43
60
|
# Raises an error with info, that used token is invalid
|
44
|
-
# @param license_config [
|
61
|
+
# @param license_config [Karafka::Core::Configurable::Node]
|
45
62
|
def raise_invalid_license_token(license_config)
|
46
63
|
# We set it to false so `Karafka.pro?` method behaves as expected
|
47
64
|
license_config.token = false
|
@@ -54,42 +71,5 @@ module Karafka
|
|
54
71
|
MSG
|
55
72
|
)
|
56
73
|
end
|
57
|
-
|
58
|
-
# Raises an error for test and dev environments if running pro with expired license
|
59
|
-
# We never want to cause any non-dev problems and we should never crash anything else than
|
60
|
-
# tests and development envs.
|
61
|
-
#
|
62
|
-
# @param expires_on [Date] when the license expires
|
63
|
-
def raise_expired_license_token_in_dev(expires_on)
|
64
|
-
env = Karafka::App.env
|
65
|
-
|
66
|
-
return unless env.development? || env.test?
|
67
|
-
|
68
|
-
raise Errors::ExpiredLicenseTokenError.new, expired_message(expires_on)
|
69
|
-
end
|
70
|
-
|
71
|
-
# We do not raise an error here as we don't want to cause any problems to someone that runs
|
72
|
-
# Karafka on production. Error message is enough.
|
73
|
-
#
|
74
|
-
# @param expires_on [Date] when the license expires
|
75
|
-
def notify_if_license_expired(expires_on)
|
76
|
-
Karafka.logger.error(expired_message(expires_on))
|
77
|
-
|
78
|
-
Karafka.monitor.instrument(
|
79
|
-
'error.occurred',
|
80
|
-
caller: self,
|
81
|
-
error: Errors::ExpiredLicenseTokenError.new(expired_message(expires_on)),
|
82
|
-
type: 'licenser.expired'
|
83
|
-
)
|
84
|
-
end
|
85
|
-
|
86
|
-
# @param expires_on [Date] when the license expires
|
87
|
-
# @return [String] expired message
|
88
|
-
def expired_message(expires_on)
|
89
|
-
<<~MSG.tr("\n", ' ')
|
90
|
-
Your license expired on #{expires_on}.
|
91
|
-
Please reach us at contact@karafka.io or visit https://karafka.io to obtain a valid one.
|
92
|
-
MSG
|
93
|
-
end
|
94
74
|
end
|
95
75
|
end
|
@@ -33,6 +33,10 @@ module Karafka
|
|
33
33
|
::ActiveSupport::JSON.decode(message.raw_payload)
|
34
34
|
)
|
35
35
|
|
36
|
+
# We cannot mark jobs as done after each if there are virtual partitions. Otherwise
|
37
|
+
# this could create random markings
|
38
|
+
next if topic.virtual_partitioner?
|
39
|
+
|
36
40
|
mark_as_consumed(message)
|
37
41
|
end
|
38
42
|
end
|
data/lib/karafka/pro/loader.rb
CHANGED
@@ -36,7 +36,7 @@ module Karafka
|
|
36
36
|
|
37
37
|
class << self
|
38
38
|
# Loads all the pro components and configures them wherever it is expected
|
39
|
-
# @param config [
|
39
|
+
# @param config [Karafka::Core::Configurable::Node] app config that we can alter with pro
|
40
40
|
# components
|
41
41
|
def setup(config)
|
42
42
|
COMPONENTS.each { |component| require_relative(component) }
|
@@ -45,7 +45,7 @@ module Karafka
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# @private
|
48
|
-
# @param event [
|
48
|
+
# @param event [Karafka::Core::Monitoring::Event] event details
|
49
49
|
# Tracks time taken to process a single message of a given topic partition
|
50
50
|
def on_consumer_consumed(event)
|
51
51
|
consumer = event[:caller]
|
@@ -1,5 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# This Karafka component is a Pro component.
|
4
|
+
# All of the commercial components are present in the lib/karafka/pro directory of this
|
5
|
+
# repository and their usage requires commercial license agreement.
|
6
|
+
#
|
7
|
+
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
8
|
+
#
|
9
|
+
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
10
|
+
# your code to Maciej Mensfeld.
|
11
|
+
|
3
12
|
module Karafka
|
4
13
|
module Pro
|
5
14
|
module Processing
|
data/lib/karafka/setup/config.rb
CHANGED
@@ -19,7 +19,20 @@ module Karafka
|
|
19
19
|
'client.id': 'karafka'
|
20
20
|
}.freeze
|
21
21
|
|
22
|
-
|
22
|
+
# Contains settings that should not be used in production but make life easier in dev
|
23
|
+
DEV_DEFAULTS = {
|
24
|
+
# Will create non-existing topics automatically.
|
25
|
+
# Note that the broker needs to be configured with `auto.create.topics.enable=true`
|
26
|
+
# While it is not recommended in prod, it simplifies work in dev
|
27
|
+
'allow.auto.create.topics': 'true',
|
28
|
+
# We refresh the cluster state often as newly created topics in dev may not be detected
|
29
|
+
# fast enough. Fast enough means within reasonable time to provide decent user experience
|
30
|
+
# While it's only a one time thing for new topics, it can still be irritating to have to
|
31
|
+
# restart the process.
|
32
|
+
'topic.metadata.refresh.interval.ms': 5_000
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
private_constant :KAFKA_DEFAULTS, :DEV_DEFAULTS
|
23
36
|
|
24
37
|
# Available settings
|
25
38
|
|
@@ -34,8 +47,6 @@ module Karafka
|
|
34
47
|
setting :token, default: false
|
35
48
|
# option entity [String] for whom we did issue the license
|
36
49
|
setting :entity, default: ''
|
37
|
-
# option expires_on [Date] date when the license expires
|
38
|
-
setting :expires_on, default: Date.parse('2100-01-01')
|
39
50
|
end
|
40
51
|
|
41
52
|
# option client_id [String] kafka client_id - used to provide
|
@@ -136,8 +147,10 @@ module Karafka
|
|
136
147
|
|
137
148
|
Contracts::Config.new.validate!(config.to_h)
|
138
149
|
|
139
|
-
|
140
|
-
|
150
|
+
licenser = Licenser.new
|
151
|
+
|
152
|
+
# Tries to load our license gem and if present will try to load the correct license
|
153
|
+
licenser.prepare_and_verify(config.license)
|
141
154
|
|
142
155
|
configure_components
|
143
156
|
|
@@ -149,13 +162,21 @@ module Karafka
|
|
149
162
|
# Propagates the kafka setting defaults unless they are already present
|
150
163
|
# This makes it easier to set some values that users usually don't change but still allows
|
151
164
|
# them to overwrite the whole hash if they want to
|
152
|
-
# @param config [
|
165
|
+
# @param config [Karafka::Core::Configurable::Node] config of this producer
|
153
166
|
def merge_kafka_defaults!(config)
|
154
167
|
KAFKA_DEFAULTS.each do |key, value|
|
155
168
|
next if config.kafka.key?(key)
|
156
169
|
|
157
170
|
config.kafka[key] = value
|
158
171
|
end
|
172
|
+
|
173
|
+
return if Karafka::App.env.production?
|
174
|
+
|
175
|
+
DEV_DEFAULTS.each do |key, value|
|
176
|
+
next if config.kafka.key?(key)
|
177
|
+
|
178
|
+
config.kafka[key] = value
|
179
|
+
end
|
159
180
|
end
|
160
181
|
|
161
182
|
# Sets up all the components that are based on the user configuration
|
data/lib/karafka/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
|
35
35
|
pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2022-08-
|
37
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: karafka-core
|
metadata.gz.sig
CHANGED
Binary file
|