rafka 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -9
- data/lib/rafka/consumer.rb +8 -3
- data/lib/rafka/message.rb +10 -4
- data/lib/rafka/producer.rb +1 -1
- 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: bd382881554109f44a7d73b49b26ae278d95edd1
|
4
|
+
data.tar.gz: a4557ecc43452232812c65e9b3c1174a6bae61e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f3f0fe3241ce4ce6006f23c3dbe62ad596b9b7e7cab14425ee796384b7e53be9ef9068e4a163ca6284999bfc6263ac73af5bdce45aafe67310b34677b9b0b6
|
7
|
+
data.tar.gz: bae37cb4f878b7a5be3a6feb99fd35a9e97b017ec4755091acda2b7e85b4d1359139e26d7be30ead961cab2c03adb853e2452046e773da105cc1a8fd3d2d7f71
|
data/README.md
CHANGED
@@ -3,19 +3,12 @@ rafka-rb: Ruby driver for Rafka
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rafka.svg)](https://badge.fury.io/rb/rafka-rb)
|
4
4
|
[![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/skroutz/rafka-rb)
|
5
5
|
|
6
|
-
|
6
|
+
rafka-rb is a thin Ruby client library for [Rafka](https://github.com/skroutz/rafka),
|
7
7
|
providing a consumer and a producer with simple semantics. It is backed by
|
8
8
|
[redis-rb](https://github.com/redis/redis-rb).
|
9
9
|
|
10
10
|
View the [API documentation](http://www.rubydoc.info/github/skroutz/rafka-rb).
|
11
11
|
|
12
|
-
Status
|
13
|
-
-------------------------------------------------------------------------------
|
14
|
-
|
15
|
-
Rafka is not yet stable and therefore is _not_ recommended for production use.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
12
|
|
20
13
|
|
21
14
|
|
@@ -41,7 +34,6 @@ and run `bundle install`.
|
|
41
34
|
|
42
35
|
|
43
36
|
|
44
|
-
|
45
37
|
Usage
|
46
38
|
-------------------------------------------------------------------------------
|
47
39
|
|
data/lib/rafka/consumer.rb
CHANGED
@@ -25,15 +25,20 @@ module Rafka
|
|
25
25
|
@topic = "topics:#{opts[:topic]}"
|
26
26
|
end
|
27
27
|
|
28
|
-
#
|
28
|
+
# Fetches the next message. Offsets are commited automatically. In the
|
29
|
+
# block form, the offset is commited only if the given block haven't
|
30
|
+
# raised any exceptions.
|
29
31
|
#
|
30
32
|
# @param timeout [Fixnum] the time in seconds to wait for a message
|
31
33
|
#
|
32
34
|
# @raise [MalformedMessageError] if the message cannot be parsed
|
33
35
|
#
|
34
|
-
# @return [nil, Message]
|
36
|
+
# @return [nil, Message]
|
35
37
|
#
|
36
|
-
# @example
|
38
|
+
# @example Consume a message
|
39
|
+
# puts consume(5).value
|
40
|
+
#
|
41
|
+
# @example Consume and commit offset if the block runs successfully
|
37
42
|
# consume(5) { |msg| puts "I received #{msg.value}" }
|
38
43
|
def consume(timeout=5)
|
39
44
|
# redis-rb didn't automatically call `CLIENT SETNAME` until v3.2.2
|
data/lib/rafka/message.rb
CHANGED
@@ -8,10 +8,16 @@ module Rafka
|
|
8
8
|
raise MalformedMessageError.new(msg)
|
9
9
|
end
|
10
10
|
|
11
|
-
@topic
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
@topic = msg[1]
|
12
|
+
|
13
|
+
begin
|
14
|
+
@partition = Integer(msg[3])
|
15
|
+
@offset = Integer(msg[5])
|
16
|
+
rescue ArgumentError
|
17
|
+
raise MalformedMessageError.new(msg)
|
18
|
+
end
|
19
|
+
|
20
|
+
@value = msg[7]
|
15
21
|
end
|
16
22
|
end
|
17
23
|
end
|
data/lib/rafka/producer.rb
CHANGED
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agis Anastasopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|