karafka 1.2.9 → 1.3.0
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 +2 -0
- data.tar.gz.sig +0 -0
- data/.coditsu/ci.yml +3 -0
- 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 +30 -10
- data/CHANGELOG.md +69 -1
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +2 -5
- data/Gemfile.lock +67 -56
- 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 +16 -14
- data/lib/karafka.rb +8 -15
- data/lib/karafka/app.rb +14 -6
- data/lib/karafka/attributes_map.rb +7 -6
- 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 +28 -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 +22 -11
- 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 +11 -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 +5 -3
- 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/builder.rb +1 -1
- 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 +65 -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 +94 -61
- 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 -35
- data/lib/karafka/persistence/topic.rb +0 -29
- data/lib/karafka/schemas/config.rb +0 -24
- data/lib/karafka/schemas/consumer_group.rb +0 -78
- 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/setup/config.rb
CHANGED
@@ -8,12 +8,16 @@ module Karafka
|
|
8
8
|
# @note If you want to do some configurations after all of this is done, please add to
|
9
9
|
# karafka/config a proper file (needs to inherit from Karafka::Setup::Configurators::Base
|
10
10
|
# and implement setup method) after that everything will happen automatically
|
11
|
-
# @note This config object allows to create a 1 level
|
11
|
+
# @note This config object allows to create a 1 level nesting (nodes) only. This should be
|
12
12
|
# enough and will still keep the code simple
|
13
13
|
# @see Karafka::Setup::Configurators::Base for more details about configurators api
|
14
14
|
class Config
|
15
15
|
extend Dry::Configurable
|
16
|
-
|
16
|
+
|
17
|
+
# Contract for checking the config provided by the user
|
18
|
+
CONTRACT = Karafka::Contracts::Config.new.freeze
|
19
|
+
|
20
|
+
private_constant :CONTRACT
|
17
21
|
|
18
22
|
# Available settings
|
19
23
|
# option client_id [String] kafka client_id - used to provide
|
@@ -22,21 +26,23 @@ module Karafka
|
|
22
26
|
# What backend do we want to use to process messages
|
23
27
|
setting :backend, :inline
|
24
28
|
# option logger [Instance] logger that we want to use
|
25
|
-
setting :logger,
|
29
|
+
setting :logger, ::Karafka::Instrumentation::Logger.new
|
26
30
|
# option monitor [Instance] monitor that we will to use (defaults to Karafka::Monitor)
|
27
|
-
setting :monitor,
|
31
|
+
setting :monitor, ::Karafka::Instrumentation::Monitor.new
|
28
32
|
# Mapper used to remap consumer groups ids, so in case users migrate from other tools
|
29
33
|
# or they need to maintain their own internal consumer group naming conventions, they
|
30
34
|
# can easily do it, replacing the default client_id + consumer name pattern concept
|
31
|
-
setting :consumer_mapper,
|
32
|
-
# Mapper used to remap names of topics, so we can have a clean internal topic
|
35
|
+
setting :consumer_mapper, Routing::ConsumerMapper.new
|
36
|
+
# Mapper used to remap names of topics, so we can have a clean internal topic naming
|
33
37
|
# despite using any Kafka provider that uses namespacing, etc
|
34
38
|
# It needs to implement two methods:
|
35
39
|
# - #incoming - for remapping from the incoming message to our internal format
|
36
40
|
# - #outgoing - for remapping from internal topic name into outgoing message
|
37
|
-
setting :topic_mapper,
|
38
|
-
# Default
|
39
|
-
setting :
|
41
|
+
setting :topic_mapper, Routing::TopicMapper.new
|
42
|
+
# Default serializer for converting whatever we want to send to kafka to json
|
43
|
+
setting :serializer, Karafka::Serialization::Json::Serializer.new
|
44
|
+
# Default deserializer for converting incoming data into ruby objects
|
45
|
+
setting :deserializer, Karafka::Serialization::Json::Deserializer.new
|
40
46
|
# If batch_fetching is true, we will fetch kafka messages in batches instead of 1 by 1
|
41
47
|
# @note Fetching does not equal consuming, see batch_consuming description for details
|
42
48
|
setting :batch_fetching, true
|
@@ -44,29 +50,15 @@ module Karafka
|
|
44
50
|
# #params_batch will contain params received from Kafka (may be more than 1) so we can
|
45
51
|
# process them in batches
|
46
52
|
setting :batch_consuming, false
|
47
|
-
# Should we operate in a single consumer instance across multiple batches of messages,
|
48
|
-
# from the same partition or should we build a new one for each incoming batch.
|
49
|
-
# Disabling that can be useful when you want to create a new consumer instance for each
|
50
|
-
# incoming batch. It's disabled by default, not to create more objects that needed
|
51
|
-
# on each batch
|
52
|
-
setting :persistent, true
|
53
53
|
# option shutdown_timeout [Integer, nil] the number of seconds after which Karafka no
|
54
|
-
# longer wait for the consumers to stop gracefully but instead we force
|
55
|
-
#
|
56
|
-
# @note Keep in mind, that if your business logic
|
57
|
-
# @note If set to nil, it won't forcefully shutdown the process at all.
|
54
|
+
# longer wait for the consumers to stop gracefully but instead we force terminate
|
55
|
+
# everything.
|
58
56
|
setting :shutdown_timeout, 60
|
59
|
-
# option params_base_class [Class] base class for params class initialization
|
60
|
-
# This can be either a Hash or a HashWithIndifferentAccess depending on your
|
61
|
-
# requirements. Note, that by using HashWithIndifferentAccess, you remove some of the
|
62
|
-
# performance in favor of convenience. This can be useful especially if you already use
|
63
|
-
# it with Rails, etc
|
64
|
-
setting :params_base_class, Hash
|
65
57
|
|
66
58
|
# option kafka [Hash] - optional - kafka configuration options
|
67
59
|
setting :kafka do
|
68
60
|
# Array with at least one host
|
69
|
-
setting :seed_brokers
|
61
|
+
setting :seed_brokers, %w[kafka://127.0.0.1:9092]
|
70
62
|
# option session_timeout [Integer] the number of seconds after which, if a client
|
71
63
|
# hasn't contacted the Kafka cluster, it will be kicked out of the group.
|
72
64
|
setting :session_timeout, 30
|
@@ -75,6 +67,11 @@ module Karafka
|
|
75
67
|
# resolved and also "slows" things down, so it prevents from "eating" up all messages and
|
76
68
|
# consuming them with failed code. Use `nil` if you want to pause forever and never retry.
|
77
69
|
setting :pause_timeout, 10
|
70
|
+
# option pause_max_timeout [Integer, nil] the maximum number of seconds to pause for,
|
71
|
+
# or `nil` if no maximum should be enforced.
|
72
|
+
setting :pause_max_timeout, nil
|
73
|
+
# option pause_exponential_backoff [Boolean] whether to enable exponential backoff
|
74
|
+
setting :pause_exponential_backoff, false
|
78
75
|
# option offset_commit_interval [Integer] the interval between offset commits,
|
79
76
|
# in seconds.
|
80
77
|
setting :offset_commit_interval, 10
|
@@ -91,7 +88,7 @@ module Karafka
|
|
91
88
|
# option fetcher_max_queue_size [Integer] max number of items in the fetch queue that
|
92
89
|
# are stored for further processing. Note, that each item in the queue represents a
|
93
90
|
# response from a single broker
|
94
|
-
setting :fetcher_max_queue_size,
|
91
|
+
setting :fetcher_max_queue_size, 10
|
95
92
|
# option max_bytes_per_partition [Integer] the maximum amount of data fetched
|
96
93
|
# from a single partition at a time.
|
97
94
|
setting :max_bytes_per_partition, 1_048_576
|
@@ -136,6 +133,8 @@ module Karafka
|
|
136
133
|
# option ssl_ca_certs_from_system [Boolean] Use the CA certs from your system's default
|
137
134
|
# certificate store
|
138
135
|
setting :ssl_ca_certs_from_system, false
|
136
|
+
# option ssl_verify_hostname [Boolean] Verify the hostname for client certs
|
137
|
+
setting :ssl_verify_hostname, true
|
139
138
|
# option ssl_client_cert [String, nil] SSL client certificate
|
140
139
|
setting :ssl_client_cert, nil
|
141
140
|
# option ssl_client_cert_key [String, nil] SSL client certificate password
|
@@ -156,10 +155,39 @@ module Karafka
|
|
156
155
|
setting :sasl_scram_password, nil
|
157
156
|
# option sasl_scram_mechanism [String, nil] Scram mechanism, either 'sha256' or 'sha512'
|
158
157
|
setting :sasl_scram_mechanism, nil
|
158
|
+
# option sasl_over_ssl [Boolean] whether to enforce SSL with SASL
|
159
|
+
setting :sasl_over_ssl, true
|
160
|
+
# option ssl_client_cert_chain [String, nil] client cert chain or nil if not used
|
161
|
+
setting :ssl_client_cert_chain, nil
|
162
|
+
# option ssl_client_cert_key_password [String, nil] the password required to read
|
163
|
+
# the ssl_client_cert_key
|
164
|
+
setting :ssl_client_cert_key_password, nil
|
165
|
+
# @param sasl_oauth_token_provider [Object, nil] OAuthBearer Token Provider instance that
|
166
|
+
# implements method token.
|
167
|
+
setting :sasl_oauth_token_provider, nil
|
168
|
+
end
|
169
|
+
|
170
|
+
# Namespace for internal settings that should not be modified
|
171
|
+
# It's a temporary step to "declassify" several things internally before we move to a
|
172
|
+
# non global state
|
173
|
+
setting :internal do
|
174
|
+
# option routing_builder [Karafka::Routing::Builder] builder instance
|
175
|
+
setting :routing_builder, Routing::Builder.new
|
176
|
+
# option status [Karafka::Status] app status
|
177
|
+
setting :status, Status.new
|
178
|
+
# option process [Karafka::Process] process status
|
179
|
+
# @note In the future, we need to have a single process representation for all the karafka
|
180
|
+
# instances
|
181
|
+
setting :process, Process.new
|
182
|
+
# option fetcher [Karafka::Fetcher] fetcher instance
|
183
|
+
setting :fetcher, Fetcher.new
|
184
|
+
# option configurators [Array<Object>] all configurators that we want to run after
|
185
|
+
# the setup
|
186
|
+
setting :configurators, [Configurators::WaterDrop.new]
|
159
187
|
end
|
160
188
|
|
161
189
|
class << self
|
162
|
-
#
|
190
|
+
# Configuring method
|
163
191
|
# @yield Runs a block of code providing a config singleton instance to it
|
164
192
|
# @yieldparam [Karafka::Setup::Config] Karafka config instance
|
165
193
|
def setup
|
@@ -170,22 +198,22 @@ module Karafka
|
|
170
198
|
# Components are in karafka/config directory and are all loaded one by one
|
171
199
|
# If you want to configure a next component, please add a proper file to config dir
|
172
200
|
def setup_components
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
201
|
+
config
|
202
|
+
.internal
|
203
|
+
.configurators
|
204
|
+
.each { |configurator| configurator.call(config) }
|
177
205
|
end
|
178
206
|
|
179
|
-
# Validate config based on
|
207
|
+
# Validate config based on the config contract
|
180
208
|
# @return [Boolean] true if configuration is valid
|
181
|
-
# @raise [Karafka::Errors::
|
182
|
-
# doesn't match with
|
209
|
+
# @raise [Karafka::Errors::InvalidConfigurationError] raised when configuration
|
210
|
+
# doesn't match with the config contract
|
183
211
|
def validate!
|
184
|
-
validation_result =
|
212
|
+
validation_result = CONTRACT.call(config.to_h)
|
185
213
|
|
186
214
|
return true if validation_result.success?
|
187
215
|
|
188
|
-
raise Errors::
|
216
|
+
raise Errors::InvalidConfigurationError, validation_result.errors.to_h
|
189
217
|
end
|
190
218
|
end
|
191
219
|
end
|
@@ -2,26 +2,30 @@
|
|
2
2
|
|
3
3
|
module Karafka
|
4
4
|
module Setup
|
5
|
-
|
5
|
+
# Configurators are used to post setup some of the components of Karafka after the core
|
6
|
+
# framework is initialized
|
7
|
+
module Configurators
|
6
8
|
# Class responsible for setting up WaterDrop configuration
|
7
|
-
class WaterDrop
|
9
|
+
class WaterDrop
|
8
10
|
# Sets up a WaterDrop settings
|
9
11
|
# @param config [Karafka::Setup::Config] Config we can user to setup things
|
10
12
|
# @note This will also inject Karafka monitor as a default monitor into WaterDrop,
|
11
13
|
# so we have the same monitor within whole Karafka framework (same with logger)
|
12
|
-
def
|
14
|
+
def call(config)
|
13
15
|
::WaterDrop.setup do |water_config|
|
14
16
|
water_config.deliver = true
|
15
17
|
|
16
18
|
config.to_h.reject { |k, _v| k == :kafka }.each do |k, v|
|
17
19
|
key_assignment = :"#{k}="
|
18
20
|
next unless water_config.respond_to?(key_assignment)
|
21
|
+
|
19
22
|
water_config.public_send(key_assignment, v)
|
20
23
|
end
|
21
24
|
|
22
25
|
config.kafka.to_h.each do |k, v|
|
23
26
|
key_assignment = :"#{k}="
|
24
27
|
next unless water_config.kafka.respond_to?(key_assignment)
|
28
|
+
|
25
29
|
water_config.kafka.public_send(key_assignment, v)
|
26
30
|
end
|
27
31
|
end
|
data/lib/karafka/setup/dsl.rb
CHANGED
data/lib/karafka/status.rb
CHANGED
@@ -3,15 +3,16 @@
|
|
3
3
|
module Karafka
|
4
4
|
# App status monitor
|
5
5
|
class Status
|
6
|
-
include Singleton
|
7
|
-
|
8
6
|
# Available states and their transitions
|
9
7
|
STATES = {
|
10
8
|
initializing: :initialize!,
|
9
|
+
initialized: :initialized!,
|
11
10
|
running: :run!,
|
12
|
-
|
11
|
+
stopping: :stop!
|
13
12
|
}.freeze
|
14
13
|
|
14
|
+
private_constant :STATES
|
15
|
+
|
15
16
|
STATES.each do |state, transition|
|
16
17
|
define_method :"#{state}?" do
|
17
18
|
@status == state
|
@@ -19,6 +20,9 @@ module Karafka
|
|
19
20
|
|
20
21
|
define_method transition do
|
21
22
|
@status = state
|
23
|
+
# Trap context disallows to run certain things that we instrument
|
24
|
+
# so the state changes are executed from a separate thread
|
25
|
+
Thread.new { Karafka.monitor.instrument("app.#{state}") }.join
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -3,4 +3,5 @@
|
|
3
3
|
# Application consumer from which all Karafka consumers should inherit
|
4
4
|
# You can rename it if it would conflict with your current code base (in case you're integrating
|
5
5
|
# Karafka with other frameworks)
|
6
|
-
ApplicationConsumer
|
6
|
+
class ApplicationConsumer < Karafka::BaseConsumer
|
7
|
+
end
|
data/lib/karafka/templates/{application_responder.rb.example → application_responder.rb.erb}
RENAMED
File without changes
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
<% if rails? -%>
|
4
|
+
ENV['RAILS_ENV'] ||= 'development'
|
5
|
+
ENV['KARAFKA_ENV'] = ENV['RAILS_ENV']
|
6
|
+
require ::File.expand_path('../config/environment', __FILE__)
|
7
|
+
Rails.application.eager_load!
|
8
|
+
|
9
|
+
# This lines will make Karafka print to stdout like puma or unicorn
|
10
|
+
if Rails.env.development?
|
11
|
+
Rails.logger.extend(
|
12
|
+
ActiveSupport::Logger.broadcast(
|
13
|
+
ActiveSupport::Logger.new($stdout)
|
14
|
+
)
|
15
|
+
)
|
16
|
+
end
|
17
|
+
<% else -%>
|
18
|
+
# This file is auto-generated during the install process.
|
19
|
+
# If by any chance you've wanted a setup for Rails app, either run the `karafka:install`
|
20
|
+
# command again or refer to the install templates available in the source codes
|
21
|
+
|
22
|
+
ENV['RACK_ENV'] ||= 'development'
|
23
|
+
ENV['KARAFKA_ENV'] ||= ENV['RACK_ENV']
|
24
|
+
Bundler.require(:default, ENV['KARAFKA_ENV'])
|
25
|
+
|
26
|
+
# Zeitwerk custom loader for loading the app components before the whole
|
27
|
+
# Karafka framework configuration
|
28
|
+
APP_LOADER = Zeitwerk::Loader.new
|
29
|
+
APP_LOADER.enable_reloading
|
30
|
+
|
31
|
+
%w[
|
32
|
+
lib
|
33
|
+
app/consumers
|
34
|
+
app/responders
|
35
|
+
app/workers
|
36
|
+
].each(&APP_LOADER.method(:push_dir))
|
37
|
+
|
38
|
+
APP_LOADER.setup
|
39
|
+
APP_LOADER.eager_load
|
40
|
+
<% end -%>
|
41
|
+
|
42
|
+
class KarafkaApp < Karafka::App
|
43
|
+
setup do |config|
|
44
|
+
config.kafka.seed_brokers = %w[kafka://127.0.0.1:9092]
|
45
|
+
config.client_id = 'example_app'
|
46
|
+
<% if rails? -%>
|
47
|
+
config.logger = Rails.logger
|
48
|
+
<% end -%>
|
49
|
+
end
|
50
|
+
|
51
|
+
# Comment out this part if you are not using instrumentation and/or you are not
|
52
|
+
# interested in logging events for certain environments. Since instrumentation
|
53
|
+
# notifications add extra boilerplate, if you want to achieve max performance,
|
54
|
+
# listen to only what you really need for given environment.
|
55
|
+
Karafka.monitor.subscribe(WaterDrop::Instrumentation::StdoutListener.new)
|
56
|
+
Karafka.monitor.subscribe(Karafka::Instrumentation::StdoutListener.new)
|
57
|
+
Karafka.monitor.subscribe(Karafka::Instrumentation::ProctitleListener.new)
|
58
|
+
|
59
|
+
# Uncomment that in order to achieve code reload in development mode
|
60
|
+
# Be aware, that this might have some side-effects. Please refer to the wiki
|
61
|
+
# for more details on benefits and downsides of the code reload in the
|
62
|
+
# development mode
|
63
|
+
#
|
64
|
+
# Karafka.monitor.subscribe(
|
65
|
+
# Karafka::CodeReloader.new(
|
66
|
+
# <%= rails? ? '*Rails.application.reloaders' : 'APP_LOADER' %>
|
67
|
+
# )
|
68
|
+
# )
|
69
|
+
|
70
|
+
consumer_groups.draw do
|
71
|
+
# topic :example do
|
72
|
+
# consumer ExampleConsumer
|
73
|
+
# end
|
74
|
+
|
75
|
+
# consumer_group :bigger_group do
|
76
|
+
# topic :test do
|
77
|
+
# consumer TestConsumer
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# topic :test2 do
|
81
|
+
# consumer Test2Consumer
|
82
|
+
# end
|
83
|
+
# end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
Karafka.monitor.subscribe('app.initialized') do
|
88
|
+
# Put here all the things you want to do after the Karafka framework
|
89
|
+
# initialization
|
90
|
+
end
|
91
|
+
|
92
|
+
KarafkaApp.boot!
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -9,81 +9,107 @@ 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-09-09 00:00:00.000000000 Z
|
14
40
|
dependencies:
|
15
41
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
42
|
+
name: dry-configurable
|
17
43
|
requirement: !ruby/object:Gem::Requirement
|
18
44
|
requirements:
|
19
|
-
- - "
|
45
|
+
- - "~>"
|
20
46
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
47
|
+
version: '0.8'
|
22
48
|
type: :runtime
|
23
49
|
prerelease: false
|
24
50
|
version_requirements: !ruby/object:Gem::Requirement
|
25
51
|
requirements:
|
26
|
-
- - "
|
52
|
+
- - "~>"
|
27
53
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
54
|
+
version: '0.8'
|
29
55
|
- !ruby/object:Gem::Dependency
|
30
|
-
name: dry-
|
56
|
+
name: dry-inflector
|
31
57
|
requirement: !ruby/object:Gem::Requirement
|
32
58
|
requirements:
|
33
59
|
- - "~>"
|
34
60
|
- !ruby/object:Gem::Version
|
35
|
-
version: '0.
|
61
|
+
version: '0.1'
|
36
62
|
type: :runtime
|
37
63
|
prerelease: false
|
38
64
|
version_requirements: !ruby/object:Gem::Requirement
|
39
65
|
requirements:
|
40
66
|
- - "~>"
|
41
67
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
68
|
+
version: '0.1'
|
43
69
|
- !ruby/object:Gem::Dependency
|
44
|
-
name: dry-
|
70
|
+
name: dry-monitor
|
45
71
|
requirement: !ruby/object:Gem::Requirement
|
46
72
|
requirements:
|
47
73
|
- - "~>"
|
48
74
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
75
|
+
version: '0.3'
|
50
76
|
type: :runtime
|
51
77
|
prerelease: false
|
52
78
|
version_requirements: !ruby/object:Gem::Requirement
|
53
79
|
requirements:
|
54
80
|
- - "~>"
|
55
81
|
- !ruby/object:Gem::Version
|
56
|
-
version: '0.
|
82
|
+
version: '0.3'
|
57
83
|
- !ruby/object:Gem::Dependency
|
58
|
-
name: dry-
|
84
|
+
name: dry-validation
|
59
85
|
requirement: !ruby/object:Gem::Requirement
|
60
86
|
requirements:
|
61
87
|
- - "~>"
|
62
88
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
89
|
+
version: '1.2'
|
64
90
|
type: :runtime
|
65
91
|
prerelease: false
|
66
92
|
version_requirements: !ruby/object:Gem::Requirement
|
67
93
|
requirements:
|
68
94
|
- - "~>"
|
69
95
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
96
|
+
version: '1.2'
|
71
97
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
98
|
+
name: envlogic
|
73
99
|
requirement: !ruby/object:Gem::Requirement
|
74
100
|
requirements:
|
75
101
|
- - "~>"
|
76
102
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
103
|
+
version: '1.1'
|
78
104
|
type: :runtime
|
79
105
|
prerelease: false
|
80
106
|
version_requirements: !ruby/object:Gem::Requirement
|
81
107
|
requirements:
|
82
108
|
- - "~>"
|
83
109
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
110
|
+
version: '1.1'
|
85
111
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
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,7 +216,11 @@ executables:
|
|
190
216
|
extensions: []
|
191
217
|
extra_rdoc_files: []
|
192
218
|
files:
|
219
|
+
- ".coditsu/ci.yml"
|
193
220
|
- ".console_irbrc"
|
221
|
+
- ".github/FUNDING.yml"
|
222
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
223
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
194
224
|
- ".gitignore"
|
195
225
|
- ".rspec"
|
196
226
|
- ".ruby-gemset"
|
@@ -204,6 +234,7 @@ files:
|
|
204
234
|
- MIT-LICENCE
|
205
235
|
- README.md
|
206
236
|
- bin/karafka
|
237
|
+
- certs/mensfeld.pem
|
207
238
|
- config/errors.yml
|
208
239
|
- karafka.gemspec
|
209
240
|
- lib/karafka.rb
|
@@ -212,9 +243,6 @@ files:
|
|
212
243
|
- lib/karafka/backends/inline.rb
|
213
244
|
- lib/karafka/base_consumer.rb
|
214
245
|
- lib/karafka/base_responder.rb
|
215
|
-
- lib/karafka/callbacks.rb
|
216
|
-
- lib/karafka/callbacks/config.rb
|
217
|
-
- lib/karafka/callbacks/dsl.rb
|
218
246
|
- lib/karafka/cli.rb
|
219
247
|
- lib/karafka/cli/base.rb
|
220
248
|
- lib/karafka/cli/console.rb
|
@@ -222,32 +250,44 @@ files:
|
|
222
250
|
- lib/karafka/cli/info.rb
|
223
251
|
- lib/karafka/cli/install.rb
|
224
252
|
- lib/karafka/cli/server.rb
|
253
|
+
- lib/karafka/code_reloader.rb
|
225
254
|
- lib/karafka/connection/api_adapter.rb
|
255
|
+
- lib/karafka/connection/batch_delegator.rb
|
226
256
|
- lib/karafka/connection/builder.rb
|
227
257
|
- lib/karafka/connection/client.rb
|
228
|
-
- lib/karafka/connection/delegator.rb
|
229
258
|
- lib/karafka/connection/listener.rb
|
259
|
+
- lib/karafka/connection/message_delegator.rb
|
230
260
|
- lib/karafka/consumers/callbacks.rb
|
231
261
|
- lib/karafka/consumers/includer.rb
|
262
|
+
- lib/karafka/consumers/metadata.rb
|
232
263
|
- lib/karafka/consumers/responders.rb
|
233
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
|
234
271
|
- lib/karafka/errors.rb
|
235
272
|
- lib/karafka/fetcher.rb
|
236
273
|
- lib/karafka/helpers/class_matcher.rb
|
237
274
|
- lib/karafka/helpers/config_retriever.rb
|
275
|
+
- lib/karafka/helpers/inflector.rb
|
238
276
|
- lib/karafka/helpers/multi_delegator.rb
|
239
|
-
- lib/karafka/instrumentation/listener.rb
|
240
277
|
- lib/karafka/instrumentation/logger.rb
|
241
278
|
- lib/karafka/instrumentation/monitor.rb
|
242
|
-
- lib/karafka/
|
243
|
-
- 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
|
244
286
|
- lib/karafka/params/params_batch.rb
|
245
|
-
- lib/karafka/parsers/json.rb
|
246
|
-
- lib/karafka/patches/dry_configurable.rb
|
247
287
|
- lib/karafka/patches/ruby_kafka.rb
|
248
288
|
- lib/karafka/persistence/client.rb
|
249
|
-
- lib/karafka/persistence/
|
250
|
-
- lib/karafka/persistence/
|
289
|
+
- lib/karafka/persistence/consumers.rb
|
290
|
+
- lib/karafka/persistence/topics.rb
|
251
291
|
- lib/karafka/process.rb
|
252
292
|
- lib/karafka/responders/builder.rb
|
253
293
|
- lib/karafka/responders/topic.rb
|
@@ -258,29 +298,23 @@ files:
|
|
258
298
|
- lib/karafka/routing/router.rb
|
259
299
|
- lib/karafka/routing/topic.rb
|
260
300
|
- lib/karafka/routing/topic_mapper.rb
|
261
|
-
- lib/karafka/
|
262
|
-
- lib/karafka/
|
263
|
-
- lib/karafka/schemas/consumer_group_topic.rb
|
264
|
-
- lib/karafka/schemas/responder_usage.rb
|
265
|
-
- lib/karafka/schemas/server_cli_options.rb
|
301
|
+
- lib/karafka/serialization/json/deserializer.rb
|
302
|
+
- lib/karafka/serialization/json/serializer.rb
|
266
303
|
- lib/karafka/server.rb
|
267
304
|
- lib/karafka/setup/config.rb
|
268
|
-
- lib/karafka/setup/configurators/base.rb
|
269
|
-
- lib/karafka/setup/configurators/params.rb
|
270
305
|
- lib/karafka/setup/configurators/water_drop.rb
|
271
306
|
- lib/karafka/setup/dsl.rb
|
272
307
|
- lib/karafka/status.rb
|
273
|
-
- lib/karafka/templates/application_consumer.rb.
|
274
|
-
- lib/karafka/templates/application_responder.rb.
|
275
|
-
- 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
|
276
311
|
- lib/karafka/version.rb
|
277
312
|
- log/.gitkeep
|
278
313
|
homepage: https://github.com/karafka/karafka
|
279
314
|
licenses:
|
280
315
|
- MIT
|
281
316
|
metadata: {}
|
282
|
-
post_install_message:
|
283
|
-
ruby-kafka in your Gemfile to version '0.6.8':\ngem 'ruby-kafka', '~> 0.6.8'\n"
|
317
|
+
post_install_message:
|
284
318
|
rdoc_options: []
|
285
319
|
require_paths:
|
286
320
|
- lib
|
@@ -288,15 +322,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
288
322
|
requirements:
|
289
323
|
- - ">="
|
290
324
|
- !ruby/object:Gem::Version
|
291
|
-
version: 2.
|
325
|
+
version: 2.4.0
|
292
326
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
293
327
|
requirements:
|
294
328
|
- - ">="
|
295
329
|
- !ruby/object:Gem::Version
|
296
330
|
version: '0'
|
297
331
|
requirements: []
|
298
|
-
|
299
|
-
rubygems_version: 2.7.6
|
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
|