rafka 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rafka/consumer.rb +3 -2
- data/lib/rafka/producer.rb +5 -2
- data/lib/rafka/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: d22b37dbbd835861eab2d1de45be8194ef0d0378
|
4
|
+
data.tar.gz: c2356e4e9e1014a6139e151808559b09fe72081b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b30363423f40411dc406e1f2b27d730780c4ffacc9bc971b2ba063449fed15e2d7f68bd4b9ceeafd18c61c608c3b2100015d4b71ceee1cf279cdd939fc57f3f4
|
7
|
+
data.tar.gz: 5b44cf07218a2d7041a49b4328f57111e415f802da9dbcdaad1dccbc5d3ab909482abe323ff113506f0065a166a03cdf3d5af204a1cf0cea92e2c19ddf92abfc
|
data/lib/rafka/consumer.rb
CHANGED
@@ -20,7 +20,8 @@ module Rafka
|
|
20
20
|
# @option opts [Hash] :redis ({}) Optional configuration for the
|
21
21
|
# underlying Redis client
|
22
22
|
def initialize(opts={})
|
23
|
-
@
|
23
|
+
@options = parse_opts(opts)
|
24
|
+
@redis = Redis.new(@options)
|
24
25
|
@topic = "topics:#{opts[:topic]}"
|
25
26
|
end
|
26
27
|
|
@@ -51,7 +52,7 @@ module Rafka
|
|
51
52
|
|
52
53
|
begin
|
53
54
|
Rafka.wrap_errors do
|
54
|
-
Rafka.with_retry do
|
55
|
+
Rafka.with_retry(times: @options[:reconnect_attempts]) do
|
55
56
|
msg = @redis.blpop(@topic, timeout: timeout)
|
56
57
|
end
|
57
58
|
end
|
data/lib/rafka/producer.rb
CHANGED
@@ -15,7 +15,8 @@ module Rafka
|
|
15
15
|
#
|
16
16
|
# @return [Producer]
|
17
17
|
def initialize(opts={})
|
18
|
-
@
|
18
|
+
@options = parse_opts(opts)
|
19
|
+
@redis = Redis.new(@options)
|
19
20
|
end
|
20
21
|
|
21
22
|
# Produce a message. This is an asynchronous operation.
|
@@ -27,7 +28,9 @@ module Rafka
|
|
27
28
|
# produce("greetings", "Hello there!")
|
28
29
|
def produce(topic, msg)
|
29
30
|
Rafka.wrap_errors do
|
30
|
-
|
31
|
+
Rafka.with_retry(times: @options[:reconnect_attempts]) do
|
32
|
+
@redis.rpushx("topics:#{topic}", msg.to_s)
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
data/lib/rafka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agis Anastasopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|