waterdrop 0.3.2.3 → 0.3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/.travis.yml +0 -1
- data/CHANGELOG.md +2 -0
- data/Gemfile +2 -5
- data/Gemfile.lock +23 -140
- data/README.md +15 -8
- data/Rakefile +4 -14
- data/lib/water_drop/config.rb +11 -0
- data/lib/water_drop/message.rb +3 -1
- data/lib/water_drop/pool.rb +2 -0
- data/lib/water_drop/producer_proxy.rb +10 -3
- data/lib/water_drop/version.rb +2 -1
- data/lib/water_drop.rb +6 -4
- data/lib/waterdrop.rb +2 -0
- data/waterdrop.gemspec +8 -3
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8146a30bc7d849c7e9bd8d5ab6a3e65697467a4
|
4
|
+
data.tar.gz: b6b606e0194c98093293fd42fb891d821a2937a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e49033efc2f820a6c61591f475f9ff2c9782b8867a10b95ff31d4a375f0979913aa96315ac93ade25befbad558309ebc95c1015de98b21933c19b7b745a8c7c
|
7
|
+
data.tar.gz: 54a112efc2652be8e0315b183f7fb3e7c16322d3cd67ef145d3f49c6ba172baf9cffdd374b2651bfe07c9500b150cb5d78d6c6ae4da73e31368121dd58d8faa6
|
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
waterdrop (0.3.2.
|
4
|
+
waterdrop (0.3.2.4)
|
5
5
|
bundler
|
6
6
|
connection_pool
|
7
7
|
dry-configurable (~> 0.6)
|
@@ -12,158 +12,41 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
|
16
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (~> 0.7)
|
18
|
-
minitest (~> 5.1)
|
19
|
-
tzinfo (~> 1.1)
|
20
|
-
addressable (2.4.0)
|
21
|
-
ast (2.3.0)
|
22
|
-
axiom-types (0.1.1)
|
23
|
-
descendants_tracker (~> 0.0.4)
|
24
|
-
ice_nine (~> 0.11.0)
|
25
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
26
|
-
brakeman (3.3.3)
|
27
|
-
bundler-audit (0.5.0)
|
28
|
-
bundler (~> 1.2)
|
29
|
-
thor (~> 0.18)
|
30
|
-
codeclimate-engine-rb (0.3.1)
|
31
|
-
virtus (~> 1.0)
|
32
|
-
coderay (1.1.1)
|
33
|
-
coercible (1.0.0)
|
34
|
-
descendants_tracker (~> 0.0.1)
|
35
|
-
colorize (0.8.1)
|
36
|
-
concurrent-ruby (1.0.4)
|
15
|
+
concurrent-ruby (1.0.5)
|
37
16
|
connection_pool (2.2.1)
|
38
|
-
|
39
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
40
|
-
diff-lcs (1.2.5)
|
17
|
+
diff-lcs (1.3)
|
41
18
|
docile (1.1.5)
|
42
|
-
dry-configurable (0.
|
19
|
+
dry-configurable (0.7.0)
|
43
20
|
concurrent-ruby (~> 1.0)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
path_expander (~> 1.0)
|
55
|
-
ruby_parser (~> 3.1, > 3.1.0)
|
56
|
-
sexp_processor (~> 4.4)
|
57
|
-
haml (4.0.7)
|
58
|
-
tilt
|
59
|
-
haml_lint (0.18.1)
|
60
|
-
haml (~> 4.0)
|
61
|
-
rake (>= 10, < 12)
|
62
|
-
rubocop (>= 0.36.0)
|
63
|
-
sysexits (~> 1.1)
|
64
|
-
i18n (0.7.0)
|
65
|
-
ice_nine (0.11.2)
|
66
|
-
json (2.0.2)
|
67
|
-
launchy (2.4.3)
|
68
|
-
addressable (~> 2.3)
|
69
|
-
method_source (0.8.2)
|
70
|
-
minitest (5.10.1)
|
71
|
-
null-logger (0.1.3)
|
72
|
-
parser (2.3.1.2)
|
73
|
-
ast (~> 2.2)
|
74
|
-
path_expander (1.0.0)
|
75
|
-
polishgeeks-dev-tools (1.3.2)
|
76
|
-
brakeman
|
77
|
-
bundler-audit
|
78
|
-
faker
|
79
|
-
haml_lint
|
80
|
-
pry
|
81
|
-
rspec
|
82
|
-
rubocop
|
83
|
-
rubocop-rspec
|
84
|
-
rubycritic
|
85
|
-
shoulda
|
86
|
-
simplecov
|
87
|
-
timecop
|
88
|
-
yard
|
89
|
-
powerpack (0.1.1)
|
90
|
-
pry (0.10.4)
|
91
|
-
coderay (~> 1.1.0)
|
92
|
-
method_source (~> 0.8.1)
|
93
|
-
slop (~> 3.4)
|
94
|
-
rainbow (2.1.0)
|
95
|
-
rake (11.3.0)
|
96
|
-
reek (4.1.0)
|
97
|
-
codeclimate-engine-rb (~> 0.3.1)
|
98
|
-
parser (~> 2.3.1, >= 2.3.1.2)
|
99
|
-
rainbow (~> 2.0)
|
100
|
-
rspec (3.5.0)
|
101
|
-
rspec-core (~> 3.5.0)
|
102
|
-
rspec-expectations (~> 3.5.0)
|
103
|
-
rspec-mocks (~> 3.5.0)
|
104
|
-
rspec-core (3.5.1)
|
105
|
-
rspec-support (~> 3.5.0)
|
106
|
-
rspec-expectations (3.5.0)
|
21
|
+
json (2.1.0)
|
22
|
+
null-logger (0.1.4)
|
23
|
+
rake (12.0.0)
|
24
|
+
rspec (3.6.0)
|
25
|
+
rspec-core (~> 3.6.0)
|
26
|
+
rspec-expectations (~> 3.6.0)
|
27
|
+
rspec-mocks (~> 3.6.0)
|
28
|
+
rspec-core (3.6.0)
|
29
|
+
rspec-support (~> 3.6.0)
|
30
|
+
rspec-expectations (3.6.0)
|
107
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
-
rspec-support (~> 3.
|
109
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.6.0)
|
33
|
+
rspec-mocks (3.6.0)
|
110
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
111
|
-
rspec-support (~> 3.
|
112
|
-
rspec-support (3.
|
113
|
-
|
114
|
-
|
115
|
-
powerpack (~> 0.1)
|
116
|
-
rainbow (>= 1.99.1, < 3.0)
|
117
|
-
ruby-progressbar (~> 1.7)
|
118
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
119
|
-
rubocop-rspec (1.5.1)
|
120
|
-
rubocop (>= 0.41.2)
|
121
|
-
ruby-kafka (0.3.16)
|
122
|
-
ruby-progressbar (1.8.1)
|
123
|
-
ruby_parser (3.8.2)
|
124
|
-
sexp_processor (~> 4.1)
|
125
|
-
rubycritic (2.9.2)
|
126
|
-
colorize
|
127
|
-
flay (= 2.8.0)
|
128
|
-
flog (= 4.4.0)
|
129
|
-
launchy (= 2.4.3)
|
130
|
-
parser (= 2.3.1.2)
|
131
|
-
reek (= 4.1.0)
|
132
|
-
ruby_parser (~> 3.8)
|
133
|
-
virtus (~> 1.0)
|
134
|
-
sexp_processor (4.7.0)
|
135
|
-
shoulda (3.5.0)
|
136
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
137
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
138
|
-
shoulda-context (1.2.1)
|
139
|
-
shoulda-matchers (2.8.0)
|
140
|
-
activesupport (>= 3.0.0)
|
141
|
-
simplecov (0.12.0)
|
35
|
+
rspec-support (~> 3.6.0)
|
36
|
+
rspec-support (3.6.0)
|
37
|
+
ruby-kafka (0.3.17)
|
38
|
+
simplecov (0.14.1)
|
142
39
|
docile (~> 1.1.0)
|
143
40
|
json (>= 1.8, < 3)
|
144
41
|
simplecov-html (~> 0.10.0)
|
145
|
-
simplecov-html (0.10.
|
146
|
-
slop (3.6.0)
|
147
|
-
sysexits (1.2.0)
|
148
|
-
thor (0.19.1)
|
149
|
-
thread_safe (0.3.5)
|
150
|
-
tilt (2.0.5)
|
151
|
-
timecop (0.8.1)
|
152
|
-
tzinfo (1.2.2)
|
153
|
-
thread_safe (~> 0.1)
|
154
|
-
unicode-display_width (1.1.0)
|
155
|
-
virtus (1.0.5)
|
156
|
-
axiom-types (~> 0.1)
|
157
|
-
coercible (~> 1.0)
|
158
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
159
|
-
equalizer (~> 0.0, >= 0.0.9)
|
160
|
-
yard (0.9.5)
|
42
|
+
simplecov-html (0.10.1)
|
161
43
|
|
162
44
|
PLATFORMS
|
163
45
|
ruby
|
164
46
|
|
165
47
|
DEPENDENCIES
|
166
|
-
|
48
|
+
rspec (~> 3.6.0)
|
49
|
+
simplecov (~> 0.14.1)
|
167
50
|
waterdrop!
|
168
51
|
|
169
52
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -29,13 +29,16 @@ bundle install
|
|
29
29
|
|
30
30
|
WaterDrop has following configuration options:
|
31
31
|
|
32
|
-
| Option
|
33
|
-
|
34
|
-
| send_messages
|
35
|
-
| kafka.hosts
|
36
|
-
| connection_pool_size
|
37
|
-
| connection_pool_timeout | Integer | Kafka connection pool timeout |
|
38
|
-
| raise_on_failure
|
32
|
+
| Option | Required | Value type | Description |
|
33
|
+
|---------------------------|------------|---------------|----------------------------------|
|
34
|
+
| send_messages | true | Boolean | Should we send messages to Kafka |
|
35
|
+
| kafka.hosts | true | Array<String> | Kafka servers hosts with ports |
|
36
|
+
| connection_pool_size | true | Integer | Kafka connection pool size |
|
37
|
+
| connection_pool_timeout | true | Integer | Kafka connection pool timeout |
|
38
|
+
| raise_on_failure | true | Boolean | Should we raise an exception when we cannot send message to Kafka - if false will silently ignore failures (will just ignore them) |
|
39
|
+
| kafka.ssl.ca_cert | false | String | SSL CA certificate |
|
40
|
+
| kafka.ssl.client_cert | false | String | SSL client certificate |
|
41
|
+
| kafka.ssl.client_cert_key | false | String | SSL client certificate password |
|
39
42
|
|
40
43
|
To apply this configuration, you need to use a *setup* method:
|
41
44
|
|
@@ -99,7 +102,11 @@ Make your feature addition or bug fix.
|
|
99
102
|
Add tests for it. This is important so I don't break it in a future version unintentionally.
|
100
103
|
Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull). Send me a pull request. Bonus points for topic branches.
|
101
104
|
|
102
|
-
|
105
|
+
[![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://coditsu.io)
|
106
|
+
|
107
|
+
Each pull request must pass our quality requirements. To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combinse multiple linters and code analyzers. Unfortunately, for now it is invite-only based, so just ping us and we will give you access to the quality results.
|
108
|
+
|
109
|
+
Please run:
|
103
110
|
|
104
111
|
```bash
|
105
112
|
bundle exec rake
|
data/Rakefile
CHANGED
@@ -1,17 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'bundler'
|
2
3
|
require 'rake'
|
3
|
-
require '
|
4
|
+
require 'rspec/core/rake_task'
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
config.haml_lint = false
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Self check using polishgeeks-dev-tools'
|
11
|
-
task :check do
|
12
|
-
PolishGeeks::DevTools::Runner.new.execute(
|
13
|
-
PolishGeeks::DevTools::Logger.new
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
task default: :check
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
task default: :spec
|
data/lib/water_drop/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WaterDrop
|
2
4
|
# Configurator for setting up all options required by WaterDrop
|
3
5
|
class Config
|
@@ -17,6 +19,15 @@ module WaterDrop
|
|
17
19
|
setting :kafka do
|
18
20
|
# @option hosts [Array<String>] Array that contains Kafka hosts with ports
|
19
21
|
setting :hosts
|
22
|
+
# SSL authentication related settings
|
23
|
+
setting :ssl do
|
24
|
+
# option ca_cert [String] SSL CA certificate
|
25
|
+
setting :ca_cert, nil
|
26
|
+
# option client_cert [String] SSL client certificate
|
27
|
+
setting :client_cert, nil
|
28
|
+
# option client_cert_key [String] SSL client certificate password
|
29
|
+
setting :client_cert_key, nil
|
30
|
+
end
|
20
31
|
end
|
21
32
|
|
22
33
|
class << self
|
data/lib/water_drop/message.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WaterDrop
|
2
4
|
# Message class which encapsulate single Kafka message logic and its delivery
|
3
5
|
class Message
|
@@ -6,7 +8,7 @@ module WaterDrop
|
|
6
8
|
# @param topic [String, Symbol] a topic to which we want to send a message
|
7
9
|
# @param message [Object] any object that can be serialized to a JSON string or
|
8
10
|
# that can be casted to a string
|
9
|
-
# @param options [Hash] (optional)
|
11
|
+
# @param options [Hash] (optional) additional options to pass to the Kafka producer
|
10
12
|
# @return [WaterDrop::Message] WaterDrop message instance
|
11
13
|
# @example Creating a new message
|
12
14
|
# WaterDrop::Message.new(topic, message)
|
data/lib/water_drop/pool.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WaterDrop
|
2
4
|
# Proxy object for a producer (sender) objects that are inside pool
|
3
5
|
# We use it to provide additional timeout monitoring layer
|
4
6
|
# There used to be an issue with Poseidon (previous engine for this lib)
|
5
7
|
# usage of sockets that are old and not used - that's why we just
|
6
8
|
# reinitialize connection if the connection layer is not being used for too long
|
7
|
-
# We keep this logic to avoid problems just in case. If those problems won't
|
9
|
+
# We keep this logic to avoid problems just in case. If those problems won't occur
|
8
10
|
# with Ruby-Kafka, we will drop it
|
9
11
|
class ProducerProxy
|
10
12
|
# How long should be object considered alive if nothing is being
|
@@ -54,7 +56,12 @@ module WaterDrop
|
|
54
56
|
# @return [Kafka::Producer] producer instance to which we can forward method requests
|
55
57
|
def producer
|
56
58
|
reload! if dead?
|
57
|
-
@producer ||= Kafka.new(
|
59
|
+
@producer ||= Kafka.new(
|
60
|
+
seed_brokers: ::WaterDrop.config.kafka.hosts,
|
61
|
+
ssl_ca_cert: ::WaterDrop.config.kafka.ssl.ca_cert,
|
62
|
+
ssl_client_cert: ::WaterDrop.config.kafka.ssl.client_cert,
|
63
|
+
ssl_client_cert_key: ::WaterDrop.config.kafka.ssl.client_cert_key
|
64
|
+
).producer
|
58
65
|
end
|
59
66
|
|
60
67
|
# @return [Boolean] true if we cannot use producer anymore because it was not used for a
|
@@ -65,7 +72,7 @@ module WaterDrop
|
|
65
72
|
|
66
73
|
# Resets a producer so a new one will be created once requested
|
67
74
|
def reload!
|
68
|
-
@producer
|
75
|
+
@producer&.shutdown
|
69
76
|
@producer = nil
|
70
77
|
end
|
71
78
|
end
|
data/lib/water_drop/version.rb
CHANGED
data/lib/water_drop.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# External components
|
2
|
-
%w
|
4
|
+
%w[
|
3
5
|
rake
|
4
6
|
rubygems
|
5
7
|
bundler
|
@@ -11,18 +13,18 @@
|
|
11
13
|
connection_pool
|
12
14
|
null_logger
|
13
15
|
dry-configurable
|
14
|
-
|
16
|
+
].each { |lib| require lib }
|
15
17
|
|
16
18
|
# Internal components
|
17
19
|
base_path = File.dirname(__FILE__) + '/water_drop'
|
18
20
|
|
19
|
-
%w
|
21
|
+
%w[
|
20
22
|
version
|
21
23
|
producer_proxy
|
22
24
|
pool
|
23
25
|
config
|
24
26
|
message
|
25
|
-
|
27
|
+
].each { |lib| require "#{base_path}/#{lib}" }
|
26
28
|
|
27
29
|
# WaterDrop library
|
28
30
|
module WaterDrop
|
data/lib/waterdrop.rb
CHANGED
data/waterdrop.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('../lib', __FILE__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
|
@@ -8,9 +10,9 @@ Gem::Specification.new do |spec|
|
|
8
10
|
spec.version = ::WaterDrop::VERSION
|
9
11
|
spec.platform = Gem::Platform::RUBY
|
10
12
|
spec.authors = ['Maciej Mensfeld', 'Pavlo Vavruk']
|
11
|
-
spec.email = %w
|
13
|
+
spec.email = %w[maciej@mensfeld.pl pavlo.vavruk@gmail.com]
|
12
14
|
spec.homepage = 'https://github.com/karafka/waterdrop'
|
13
|
-
spec.summary =
|
15
|
+
spec.summary = ' Kafka messaging made easy! '
|
14
16
|
spec.description = spec.summary
|
15
17
|
spec.license = 'MIT'
|
16
18
|
|
@@ -20,9 +22,12 @@ Gem::Specification.new do |spec|
|
|
20
22
|
spec.add_dependency 'connection_pool', '>= 0'
|
21
23
|
spec.add_dependency 'null-logger'
|
22
24
|
spec.add_dependency 'dry-configurable', '~> 0.6'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.6.0'
|
27
|
+
spec.add_development_dependency 'simplecov', '~> 0.14.1'
|
23
28
|
spec.required_ruby_version = '>= 2.2.0'
|
24
29
|
|
25
30
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
26
31
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
27
|
-
spec.require_paths = %w
|
32
|
+
spec.require_paths = %w[lib]
|
28
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waterdrop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.2.
|
4
|
+
version: 0.3.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -95,6 +95,34 @@ dependencies:
|
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0.6'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rspec
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 3.6.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 3.6.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: simplecov
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.14.1
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.14.1
|
98
126
|
description: Kafka messaging made easy!
|
99
127
|
email:
|
100
128
|
- maciej@mensfeld.pl
|