waterdrop 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +40 -35
- data/README.md +4 -1
- data/lib/water_drop/message.rb +1 -1
- data/lib/water_drop/producer_proxy.rb +12 -1
- data/lib/water_drop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eaaa93109e4512ca5227b24d5d07b440c5abca97
|
|
4
|
+
data.tar.gz: f6beefb7fccb3c5dd7a0bbacfc6aa949fd8a215b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6bfa48ad2e2de05ab0ab93afcd3583634d83b050f11fa850cab0b574614fab67c86a66f4436df9a5ee75f62337f49c3557e16860b8b9ca639a83e433837c4d0
|
|
7
|
+
data.tar.gz: 979a187dd49c9ac2993d67b59349a0c7131b3aa96bd2563595ff78f8e1cc9634b734c84437e0478f9d541e79e91a26c6a451446e0f6a950fcffb25cfb8bfed9d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# WaterDrop changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
- Removed default to_json casting because of binary/other data types incompatibility. This is an incompatibility. If you use WaterDrop, please add a proper casting method to places where you use it.
|
|
5
|
+
- Gem dump
|
|
6
|
+
|
|
3
7
|
## 0.1.11
|
|
4
8
|
- Poseidon options extractions and tweaks
|
|
5
9
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
waterdrop (0.1.
|
|
4
|
+
waterdrop (0.1.12)
|
|
5
5
|
aspector
|
|
6
6
|
bundler
|
|
7
7
|
connection_pool
|
|
@@ -13,10 +13,10 @@ GEM
|
|
|
13
13
|
remote: https://rubygems.org/
|
|
14
14
|
specs:
|
|
15
15
|
abstract_type (0.0.7)
|
|
16
|
-
activemodel (4.2.
|
|
17
|
-
activesupport (= 4.2.
|
|
16
|
+
activemodel (4.2.5)
|
|
17
|
+
activesupport (= 4.2.5)
|
|
18
18
|
builder (~> 3.1)
|
|
19
|
-
activesupport (4.2.
|
|
19
|
+
activesupport (4.2.5)
|
|
20
20
|
i18n (~> 0.7)
|
|
21
21
|
json (~> 1.7, >= 1.7.7)
|
|
22
22
|
minitest (~> 5.1)
|
|
@@ -33,7 +33,7 @@ GEM
|
|
|
33
33
|
descendants_tracker (~> 0.0.4)
|
|
34
34
|
ice_nine (~> 0.11.0)
|
|
35
35
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
36
|
-
brakeman (3.1.
|
|
36
|
+
brakeman (3.1.2)
|
|
37
37
|
erubis (~> 2.6)
|
|
38
38
|
fastercsv (~> 1.5)
|
|
39
39
|
haml (>= 3.0, < 5.0)
|
|
@@ -41,6 +41,7 @@ GEM
|
|
|
41
41
|
multi_json (~> 1.2)
|
|
42
42
|
ruby2ruby (>= 2.1.1, < 2.3.0)
|
|
43
43
|
ruby_parser (~> 3.7.0)
|
|
44
|
+
safe_yaml
|
|
44
45
|
sass (~> 3.0)
|
|
45
46
|
slim (>= 1.3.6, < 4.0)
|
|
46
47
|
terminal-table (~> 1.4)
|
|
@@ -59,13 +60,13 @@ GEM
|
|
|
59
60
|
docile (1.1.5)
|
|
60
61
|
equalizer (0.0.11)
|
|
61
62
|
erubis (2.7.0)
|
|
62
|
-
faker (1.
|
|
63
|
+
faker (1.6.1)
|
|
63
64
|
i18n (~> 0.5)
|
|
64
65
|
fastercsv (1.5.5)
|
|
65
|
-
flay (2.
|
|
66
|
+
flay (2.6.1)
|
|
66
67
|
ruby_parser (~> 3.0)
|
|
67
68
|
sexp_processor (~> 4.0)
|
|
68
|
-
flog (4.2
|
|
69
|
+
flog (4.3.2)
|
|
69
70
|
ruby_parser (~> 3.1, > 3.1.0)
|
|
70
71
|
sexp_processor (~> 4.4)
|
|
71
72
|
haml (4.0.7)
|
|
@@ -81,10 +82,10 @@ GEM
|
|
|
81
82
|
memoizable (0.4.2)
|
|
82
83
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
83
84
|
method_source (0.8.2)
|
|
84
|
-
minitest (5.8.
|
|
85
|
+
minitest (5.8.3)
|
|
85
86
|
mongo (2.1.2)
|
|
86
87
|
bson (~> 3.0)
|
|
87
|
-
mongoid (5.0.
|
|
88
|
+
mongoid (5.0.1)
|
|
88
89
|
activemodel (~> 4.0)
|
|
89
90
|
mongo (~> 2.1)
|
|
90
91
|
origin (~> 2.1)
|
|
@@ -98,7 +99,7 @@ GEM
|
|
|
98
99
|
origin (2.1.1)
|
|
99
100
|
parser (2.2.3.0)
|
|
100
101
|
ast (>= 1.1, < 3.0)
|
|
101
|
-
polishgeeks-dev-tools (1.2.
|
|
102
|
+
polishgeeks-dev-tools (1.2.1)
|
|
102
103
|
brakeman
|
|
103
104
|
faker
|
|
104
105
|
haml-lint
|
|
@@ -106,13 +107,14 @@ GEM
|
|
|
106
107
|
pry
|
|
107
108
|
rspec
|
|
108
109
|
rubocop
|
|
109
|
-
rubycritic
|
|
110
|
+
rubycritic
|
|
110
111
|
shoulda
|
|
111
112
|
simplecov
|
|
112
113
|
timecop
|
|
113
114
|
yard
|
|
114
115
|
poseidon (0.0.5)
|
|
115
116
|
powerpack (0.1.1)
|
|
117
|
+
private_attr (1.1.0)
|
|
116
118
|
procto (0.0.2)
|
|
117
119
|
pry (0.10.3)
|
|
118
120
|
coderay (~> 1.1.0)
|
|
@@ -120,42 +122,44 @@ GEM
|
|
|
120
122
|
slop (~> 3.4)
|
|
121
123
|
rainbow (2.0.0)
|
|
122
124
|
rake (10.4.2)
|
|
123
|
-
reek (
|
|
124
|
-
parser (~> 2.2.
|
|
125
|
-
|
|
125
|
+
reek (3.6.0)
|
|
126
|
+
parser (~> 2.2, >= 2.2.2.5)
|
|
127
|
+
private_attr (~> 1.1)
|
|
128
|
+
rainbow (~> 2.0)
|
|
126
129
|
unparser (~> 0.2.2)
|
|
127
|
-
rspec (3.
|
|
128
|
-
rspec-core (~> 3.
|
|
129
|
-
rspec-expectations (~> 3.
|
|
130
|
-
rspec-mocks (~> 3.
|
|
131
|
-
rspec-core (3.
|
|
132
|
-
rspec-support (~> 3.
|
|
133
|
-
rspec-expectations (3.
|
|
130
|
+
rspec (3.4.0)
|
|
131
|
+
rspec-core (~> 3.4.0)
|
|
132
|
+
rspec-expectations (~> 3.4.0)
|
|
133
|
+
rspec-mocks (~> 3.4.0)
|
|
134
|
+
rspec-core (3.4.1)
|
|
135
|
+
rspec-support (~> 3.4.0)
|
|
136
|
+
rspec-expectations (3.4.0)
|
|
134
137
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
135
|
-
rspec-support (~> 3.
|
|
136
|
-
rspec-mocks (3.
|
|
138
|
+
rspec-support (~> 3.4.0)
|
|
139
|
+
rspec-mocks (3.4.0)
|
|
137
140
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
138
|
-
rspec-support (~> 3.
|
|
139
|
-
rspec-support (3.
|
|
140
|
-
rubocop (0.
|
|
141
|
+
rspec-support (~> 3.4.0)
|
|
142
|
+
rspec-support (3.4.1)
|
|
143
|
+
rubocop (0.35.1)
|
|
141
144
|
astrolabe (~> 1.3)
|
|
142
|
-
parser (>= 2.2.
|
|
145
|
+
parser (>= 2.2.3.0, < 3.0)
|
|
143
146
|
powerpack (~> 0.1)
|
|
144
147
|
rainbow (>= 1.99.1, < 3.0)
|
|
145
|
-
ruby-progressbar (~> 1.
|
|
148
|
+
ruby-progressbar (~> 1.7)
|
|
149
|
+
tins (<= 1.6.0)
|
|
146
150
|
ruby-progressbar (1.7.5)
|
|
147
151
|
ruby2ruby (2.2.0)
|
|
148
152
|
ruby_parser (~> 3.1)
|
|
149
153
|
sexp_processor (~> 4.0)
|
|
150
|
-
ruby_parser (3.7.
|
|
154
|
+
ruby_parser (3.7.2)
|
|
151
155
|
sexp_processor (~> 4.1)
|
|
152
|
-
rubycritic (
|
|
153
|
-
flay (= 2.
|
|
154
|
-
flog (= 4.2
|
|
156
|
+
rubycritic (2.2.0)
|
|
157
|
+
flay (= 2.6.1)
|
|
158
|
+
flog (= 4.3.2)
|
|
155
159
|
parser (>= 2.2.0, < 3.0)
|
|
156
|
-
reek (=
|
|
157
|
-
ruby2ruby (>= 2.1.1, < 3.0)
|
|
160
|
+
reek (= 3.6.0)
|
|
158
161
|
virtus (~> 1.0)
|
|
162
|
+
safe_yaml (1.0.4)
|
|
159
163
|
sass (3.4.19)
|
|
160
164
|
sexp_processor (4.6.0)
|
|
161
165
|
shoulda (3.5.0)
|
|
@@ -179,6 +183,7 @@ GEM
|
|
|
179
183
|
thread_safe (0.3.5)
|
|
180
184
|
tilt (2.0.1)
|
|
181
185
|
timecop (0.8.0)
|
|
186
|
+
tins (1.6.0)
|
|
182
187
|
tzinfo (1.2.2)
|
|
183
188
|
thread_safe (~> 0.1)
|
|
184
189
|
unparser (0.2.4)
|
data/README.md
CHANGED
|
@@ -69,9 +69,12 @@ To send Kafka messages, you don't need to use aspects, you can create and send m
|
|
|
69
69
|
```ruby
|
|
70
70
|
message = WaterDrop::Message.new('topic', 'message')
|
|
71
71
|
message.send!
|
|
72
|
+
|
|
73
|
+
message = WaterDrop::Message.new('topic', { user_id: 1 }.to_json)
|
|
74
|
+
message.send!
|
|
72
75
|
```
|
|
73
76
|
|
|
74
|
-
message that you want to send should be either
|
|
77
|
+
message that you want to send should be either binary or stringified (to_s, to_json, etc).
|
|
75
78
|
|
|
76
79
|
### Using aspects to handle messages
|
|
77
80
|
|
data/lib/water_drop/message.rb
CHANGED
|
@@ -11,7 +11,7 @@ module WaterDrop
|
|
|
11
11
|
# WaterDrop::Message.new(topic, message)
|
|
12
12
|
def initialize(topic, message)
|
|
13
13
|
@topic = topic.to_s
|
|
14
|
-
@message = message
|
|
14
|
+
@message = message
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
# Sents a current message to Kafka
|
|
@@ -9,6 +9,11 @@ module WaterDrop
|
|
|
9
9
|
# send using it. After that time, we will recreate the connection
|
|
10
10
|
LIFE_TIME = 5 * 60 # 5 minute
|
|
11
11
|
|
|
12
|
+
# If sending fails - how many times we should try with a new connection
|
|
13
|
+
# @note It works in a similar way to Poseidon internal max_send_retries option, but it will
|
|
14
|
+
# create a new connection after failure (Poseidon tries to use the same one)
|
|
15
|
+
MAX_SEND_RETRIES = 1
|
|
16
|
+
|
|
12
17
|
# All default poseidon parameters that we want to use
|
|
13
18
|
POSEIDON_PARAMS = {
|
|
14
19
|
metadata_refresh_interval_ms: 5 * 60 * 1000, # 5 minutes
|
|
@@ -17,7 +22,7 @@ module WaterDrop
|
|
|
17
22
|
required_acks: -1,
|
|
18
23
|
# @see https://issues.apache.org/jira/browse/KAFKA-1494
|
|
19
24
|
retry_backoff_ms: 1000,
|
|
20
|
-
max_send_retries:
|
|
25
|
+
max_send_retries: 1
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
# @return [WaterDrop::ProducerProxy] proxy object to Poseidon::Producer
|
|
@@ -25,6 +30,7 @@ module WaterDrop
|
|
|
25
30
|
# first used when we create it
|
|
26
31
|
def initialize
|
|
27
32
|
touch
|
|
33
|
+
@attempts = 0
|
|
28
34
|
end
|
|
29
35
|
|
|
30
36
|
# Sends messages to Kafka
|
|
@@ -40,7 +46,12 @@ module WaterDrop
|
|
|
40
46
|
producer.send_messages(messages)
|
|
41
47
|
rescue StandardError => e
|
|
42
48
|
reload!
|
|
49
|
+
|
|
50
|
+
retry if (@attempts += 1) <= MAX_SEND_RETRIES
|
|
51
|
+
|
|
43
52
|
raise(e)
|
|
53
|
+
ensure
|
|
54
|
+
@attempts = 0
|
|
44
55
|
end
|
|
45
56
|
|
|
46
57
|
private
|
data/lib/water_drop/version.rb
CHANGED
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.1.
|
|
4
|
+
version: 0.1.12
|
|
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: 2015-
|
|
12
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|