waterdrop 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +16 -13
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +31 -28
- data/README.md +0 -0
- data/lib/water_drop.rb +2 -15
- data/lib/water_drop/config.rb +0 -11
- data/lib/water_drop/config_applier.rb +51 -0
- data/lib/water_drop/schemas/config.rb +3 -3
- data/lib/water_drop/version.rb +1 -1
- data/waterdrop.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16e9f91529a5da89677a60544ce9155394740a91d6fae583308f3a44b95ab3ff
|
4
|
+
data.tar.gz: 49a4f2d7d76a528c1f51ee53275f85e943128822f3843fd8eace07482a9b5b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d194a32da0ef7dbdeb14b063dc959a240ac5658a238812046baad037a7e25cff2e9ac8cfe91166cf2e0ad9b3972d78b6760bc2e48ee1c214ed32d25378d5336
|
7
|
+
data.tar.gz: 8b9aa9263ba3774e54692b9baae4839ef8b2689be2687ed0672fa23014ff9bb23437c756bbf07d4d7b38164d8d3a49a8ee17acfb0b1ae193e2279881951cffb4
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
|
1
|
+
dist: trusty
|
2
2
|
sudo: false
|
3
|
+
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
|
3
6
|
rvm:
|
4
|
-
- 2.3.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
-
|
8
|
-
- 2.
|
9
|
-
|
10
|
-
- 2.4.1
|
11
|
-
- 2.4.2
|
12
|
-
- 2.5.0
|
13
|
-
- jruby-head
|
14
|
-
script: bundle exec rspec spec/
|
7
|
+
- 2.3.7
|
8
|
+
- 2.4.4
|
9
|
+
- 2.5.1
|
10
|
+
- ruby-head
|
11
|
+
- jruby-9.2.0.0
|
12
|
+
|
15
13
|
env:
|
16
14
|
global:
|
17
15
|
- JRUBY_OPTS='--debug'
|
18
|
-
|
16
|
+
|
17
|
+
before_install:
|
18
|
+
- gem install bundler
|
19
|
+
- gem update --system
|
20
|
+
|
21
|
+
script: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,34 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
waterdrop (1.2.
|
4
|
+
waterdrop (1.2.3)
|
5
5
|
delivery_boy (~> 0.2)
|
6
6
|
dry-configurable (~> 0.7)
|
7
7
|
dry-monitor (~> 0.1)
|
8
8
|
dry-validation (~> 0.11)
|
9
9
|
null-logger (~> 0.1)
|
10
|
+
ruby-kafka (~> 0.6.8)
|
10
11
|
|
11
12
|
GEM
|
12
13
|
remote: https://rubygems.org/
|
13
14
|
specs:
|
14
15
|
concurrent-ruby (1.0.5)
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
concurrent-ruby (1.0.5-java)
|
17
|
+
delivery_boy (0.2.7)
|
18
|
+
king_konf (~> 0.2)
|
19
|
+
ruby-kafka (~> 0.5)
|
18
20
|
diff-lcs (1.3)
|
19
|
-
docile (1.3.
|
21
|
+
docile (1.3.1)
|
20
22
|
dry-configurable (0.7.0)
|
21
23
|
concurrent-ruby (~> 1.0)
|
22
24
|
dry-container (0.6.0)
|
23
25
|
concurrent-ruby (~> 1.0)
|
24
26
|
dry-configurable (~> 0.1, >= 0.1.3)
|
25
|
-
dry-core (0.4.
|
27
|
+
dry-core (0.4.7)
|
26
28
|
concurrent-ruby (~> 1.0)
|
27
|
-
dry-equalizer (0.2.
|
29
|
+
dry-equalizer (0.2.1)
|
28
30
|
dry-events (0.1.0)
|
29
31
|
concurrent-ruby (~> 1.0)
|
30
32
|
dry-core (~> 0.4)
|
31
33
|
dry-equalizer (~> 0.2)
|
34
|
+
dry-inflector (0.1.2)
|
32
35
|
dry-logic (0.4.2)
|
33
36
|
dry-container (~> 0.2, >= 0.2.6)
|
34
37
|
dry-core (~> 0.2)
|
@@ -38,40 +41,39 @@ GEM
|
|
38
41
|
dry-equalizer (~> 0.2)
|
39
42
|
dry-events (~> 0.1)
|
40
43
|
rouge (~> 2.0, >= 2.2.1)
|
41
|
-
dry-types (0.
|
44
|
+
dry-types (0.13.2)
|
42
45
|
concurrent-ruby (~> 1.0)
|
43
|
-
dry-configurable (~> 0.1)
|
44
46
|
dry-container (~> 0.3)
|
45
|
-
dry-core (~> 0.
|
47
|
+
dry-core (~> 0.4, >= 0.4.4)
|
46
48
|
dry-equalizer (~> 0.2)
|
49
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
47
50
|
dry-logic (~> 0.4, >= 0.4.2)
|
48
|
-
|
49
|
-
dry-validation (0.11.1)
|
51
|
+
dry-validation (0.12.1)
|
50
52
|
concurrent-ruby (~> 1.0)
|
51
53
|
dry-configurable (~> 0.1, >= 0.1.3)
|
52
54
|
dry-core (~> 0.2, >= 0.2.1)
|
53
55
|
dry-equalizer (~> 0.2)
|
54
56
|
dry-logic (~> 0.4, >= 0.4.0)
|
55
|
-
dry-types (~> 0.
|
56
|
-
inflecto (0.0.2)
|
57
|
+
dry-types (~> 0.13.1)
|
57
58
|
json (2.1.0)
|
58
|
-
|
59
|
+
json (2.1.0-java)
|
60
|
+
king_konf (0.3.6)
|
59
61
|
null-logger (0.1.5)
|
60
62
|
rouge (2.2.1)
|
61
|
-
rspec (3.
|
62
|
-
rspec-core (~> 3.
|
63
|
-
rspec-expectations (~> 3.
|
64
|
-
rspec-mocks (~> 3.
|
65
|
-
rspec-core (3.
|
66
|
-
rspec-support (~> 3.
|
67
|
-
rspec-expectations (3.
|
63
|
+
rspec (3.8.0)
|
64
|
+
rspec-core (~> 3.8.0)
|
65
|
+
rspec-expectations (~> 3.8.0)
|
66
|
+
rspec-mocks (~> 3.8.0)
|
67
|
+
rspec-core (3.8.0)
|
68
|
+
rspec-support (~> 3.8.0)
|
69
|
+
rspec-expectations (3.8.1)
|
68
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
-
rspec-support (~> 3.
|
70
|
-
rspec-mocks (3.
|
71
|
+
rspec-support (~> 3.8.0)
|
72
|
+
rspec-mocks (3.8.0)
|
71
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
-
rspec-support (~> 3.
|
73
|
-
rspec-support (3.
|
74
|
-
ruby-kafka (0.
|
74
|
+
rspec-support (~> 3.8.0)
|
75
|
+
rspec-support (3.8.0)
|
76
|
+
ruby-kafka (0.6.8)
|
75
77
|
simplecov (0.16.1)
|
76
78
|
docile (~> 1.1)
|
77
79
|
json (>= 1.8, < 3)
|
@@ -79,6 +81,7 @@ GEM
|
|
79
81
|
simplecov-html (0.10.2)
|
80
82
|
|
81
83
|
PLATFORMS
|
84
|
+
java
|
82
85
|
ruby
|
83
86
|
|
84
87
|
DEPENDENCIES
|
@@ -87,4 +90,4 @@ DEPENDENCIES
|
|
87
90
|
waterdrop!
|
88
91
|
|
89
92
|
BUNDLED WITH
|
90
|
-
1.16.
|
93
|
+
1.16.3
|
data/README.md
CHANGED
File without changes
|
data/lib/water_drop.rb
CHANGED
@@ -23,22 +23,8 @@ module WaterDrop
|
|
23
23
|
# @param [Block] block configuration block
|
24
24
|
def setup(&block)
|
25
25
|
Config.setup(&block)
|
26
|
-
|
27
26
|
DeliveryBoy.logger = self.logger = config.logger
|
28
|
-
|
29
|
-
# Recursive lambda for mapping config down to delivery boy
|
30
|
-
applier = lambda { |db_config, h|
|
31
|
-
h.each do |k, v|
|
32
|
-
applier.call(db_config, v) && next if v.is_a?(Hash)
|
33
|
-
next unless db_config.respond_to?(:"#{k}=")
|
34
|
-
db_config.public_send(:"#{k}=", v)
|
35
|
-
end
|
36
|
-
}
|
37
|
-
|
38
|
-
DeliveryBoy.config.tap do |config|
|
39
|
-
config.brokers = Config.config.kafka.seed_brokers
|
40
|
-
applier.call(config, Config.config.to_h)
|
41
|
-
end
|
27
|
+
ConfigApplier.call(DeliveryBoy.config, Config.config.to_h)
|
42
28
|
end
|
43
29
|
|
44
30
|
# @return [WaterDrop::Config] config instance
|
@@ -65,6 +51,7 @@ end
|
|
65
51
|
schemas/message_options
|
66
52
|
schemas/config
|
67
53
|
config
|
54
|
+
config_applier
|
68
55
|
errors
|
69
56
|
base_producer
|
70
57
|
sync_producer
|
data/lib/water_drop/config.rb
CHANGED
@@ -110,17 +110,6 @@ module WaterDrop
|
|
110
110
|
setting :sasl_scram_mechanism, nil
|
111
111
|
end
|
112
112
|
|
113
|
-
# option producer [Hash] - optional - producer configuration options
|
114
|
-
setting :producer do
|
115
|
-
# option compression_codec [Symbol] Sets producer compression codec
|
116
|
-
# More: https://github.com/zendesk/ruby-kafka#compression
|
117
|
-
# More: https://github.com/zendesk/ruby-kafka/blob/master/lib/kafka/compression.rb
|
118
|
-
setting :compression_codec, nil
|
119
|
-
# option compression_codec [Integer] Sets producer compression threshold
|
120
|
-
# More: https://github.com/zendesk/ruby-kafka#compression
|
121
|
-
setting :compression_threshold, 1
|
122
|
-
end
|
123
|
-
|
124
113
|
class << self
|
125
114
|
# Configurating method
|
126
115
|
# @yield Runs a block of code providing a config singleton instance to it
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WaterDrop
|
4
|
+
# Engine used to propagate config application to DeliveryBoy with corner case handling
|
5
|
+
module ConfigApplier
|
6
|
+
class << self
|
7
|
+
# @param delivery_boy_config [DeliveryBoy::Config] delivery boy config instance
|
8
|
+
# @param settings [Hash] hash with WaterDrop settings
|
9
|
+
def call(delivery_boy_config, settings)
|
10
|
+
# Recursive lambda for mapping config down to delivery boy
|
11
|
+
settings.each do |key, value|
|
12
|
+
call(delivery_boy_config, value) && next if value.is_a?(Hash)
|
13
|
+
|
14
|
+
# If this is a special case that needs manual setup instead of a direct reassignment
|
15
|
+
if respond_to?(key, true)
|
16
|
+
send(key, delivery_boy_config, value)
|
17
|
+
else
|
18
|
+
# If this setting is our internal one, we should not sync it with the delivery boy
|
19
|
+
next unless delivery_boy_config.respond_to?(:"#{key}=")
|
20
|
+
|
21
|
+
delivery_boy_config.public_send(:"#{key}=", value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Extra setup for the compression codec as it behaves differently than other settings
|
29
|
+
# that are ported 1:1 from ruby-kafka
|
30
|
+
# For some crazy reason, delivery boy requires compression codec as a string, when
|
31
|
+
# ruby-kafka as a symbol. We follow ruby-kafka internal design, so we had to mimic
|
32
|
+
# that by assigning a stringified version that down the road will be symbolized again
|
33
|
+
# by delivery boy
|
34
|
+
# @param delivery_boy_config [DeliveryBoy::Config] delivery boy config instance
|
35
|
+
# @param codec_name [Symbol] codec name as a symbol
|
36
|
+
def compression_codec(delivery_boy_config, codec_name)
|
37
|
+
# If there is no compression codec, we don't apply anything
|
38
|
+
return unless codec_name
|
39
|
+
delivery_boy_config.compression_codec = codec_name.to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
# We use the "seed_brokers" name and DeliveryBoy uses "brokers" so we pass the values
|
43
|
+
# manually
|
44
|
+
# @param delivery_boy_config [DeliveryBoy::Config] delivery boy config instance
|
45
|
+
# @param seed_brokers [Array<String>] kafka seed brokers
|
46
|
+
def seed_brokers(delivery_boy_config, seed_brokers)
|
47
|
+
delivery_boy_config.brokers = seed_brokers
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -37,10 +37,10 @@ module WaterDrop
|
|
37
37
|
|
38
38
|
required(:kafka).schema do
|
39
39
|
required(:seed_brokers).filled { each(:broker_schema?) }
|
40
|
-
required(:connect_timeout).filled
|
41
|
-
required(:socket_timeout).filled
|
40
|
+
required(:connect_timeout).filled(:int?, gt?: 0)
|
41
|
+
required(:socket_timeout).filled(:int?, gt?: 0)
|
42
42
|
required(:compression_threshold).filled(:int?, gteq?: 1)
|
43
|
-
optional(:compression_codec).maybe(included_in?: %
|
43
|
+
optional(:compression_codec).maybe(included_in?: %i[snappy gzip lz4])
|
44
44
|
|
45
45
|
required(:max_buffer_bytesize).filled(:int?, gt?: 0)
|
46
46
|
required(:max_buffer_size).filled(:int?, gt?: 0)
|
data/lib/water_drop/version.rb
CHANGED
data/waterdrop.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'dry-monitor', '~> 0.1'
|
22
22
|
spec.add_dependency 'dry-validation', '~> 0.11'
|
23
23
|
spec.add_dependency 'null-logger', '~> 0.1'
|
24
|
+
spec.add_dependency 'ruby-kafka', '~> 0.6.8'
|
24
25
|
|
25
26
|
spec.required_ruby_version = '>= 2.2.0'
|
26
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waterdrop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: delivery_boy
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ruby-kafka
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.6.8
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.6.8
|
83
97
|
description: Kafka messaging made easy!
|
84
98
|
email:
|
85
99
|
- maciej@mensfeld.pl
|
@@ -102,6 +116,7 @@ files:
|
|
102
116
|
- lib/water_drop/async_producer.rb
|
103
117
|
- lib/water_drop/base_producer.rb
|
104
118
|
- lib/water_drop/config.rb
|
119
|
+
- lib/water_drop/config_applier.rb
|
105
120
|
- lib/water_drop/errors.rb
|
106
121
|
- lib/water_drop/instrumentation/listener.rb
|
107
122
|
- lib/water_drop/instrumentation/monitor.rb
|
@@ -131,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
146
|
version: '0'
|
132
147
|
requirements: []
|
133
148
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.7.
|
149
|
+
rubygems_version: 2.7.4
|
135
150
|
signing_key:
|
136
151
|
specification_version: 4
|
137
152
|
summary: Kafka messaging made easy!
|