fluq-kafka 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/fluq-kafka.gemspec +1 -1
- data/lib/fluq/input/kafka.rb +8 -2
- data/lib/fluq/kafka.rb +1 -4
- data/lib/fluq/kafka/consumer.rb +13 -0
- data/lib/fluq/kafka/version.rb +1 -1
- data/spec/fluq/input/kafka_spec.rb +14 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 209affc0c927d251efc91a30c18cb52ddbda3827
|
4
|
+
data.tar.gz: 6b496c7f488346c6bb8792d1c3f7a1dd32da2f79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82cdf855b4d1e11ab55e0b64b8c389527521d6d6c157522adc8524a6047f4b7d6ebd29ee11e5864243ae9aace51b5fbdf5f185e295f02672a21585400d57ca4
|
7
|
+
data.tar.gz: d2a0e5989f104b778098c42d4d866ccd96819d9f70bcd352ababbb2aebcc4edf25cfac9f15249ddcc6070d6cf38a4c716570a85a4f2989a4eccc938c2528218d
|
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
fluq-kafka (0.8.
|
10
|
+
fluq-kafka (0.8.1)
|
11
11
|
fluq (~> 0.8.0)
|
12
12
|
poseidon_cluster
|
13
13
|
|
@@ -26,8 +26,8 @@ GEM
|
|
26
26
|
term-ansicolor
|
27
27
|
thor
|
28
28
|
diff-lcs (1.2.5)
|
29
|
-
docile (1.1.
|
30
|
-
fluq (0.8.
|
29
|
+
docile (1.1.3)
|
30
|
+
fluq (0.8.1)
|
31
31
|
celluloid-io (~> 0.15.0)
|
32
32
|
multi_json
|
33
33
|
timed_lru
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
multi_json (1.8.4)
|
39
39
|
nio4r (1.0.0)
|
40
40
|
nio4r (1.0.0-java)
|
41
|
-
poseidon_cluster (0.0
|
41
|
+
poseidon_cluster (0.1.0)
|
42
42
|
poseidon
|
43
43
|
zk
|
44
44
|
rake (10.1.1)
|
@@ -49,9 +49,9 @@ GEM
|
|
49
49
|
rspec-expectations (~> 2.14.0)
|
50
50
|
rspec-mocks (~> 2.14.0)
|
51
51
|
rspec-core (2.14.7)
|
52
|
-
rspec-expectations (2.14.
|
52
|
+
rspec-expectations (2.14.5)
|
53
53
|
diff-lcs (>= 1.1.3, < 2.0)
|
54
|
-
rspec-mocks (2.14.
|
54
|
+
rspec-mocks (2.14.5)
|
55
55
|
simplecov (0.8.2)
|
56
56
|
docile (~> 1.1.0)
|
57
57
|
multi_json
|
@@ -64,7 +64,7 @@ GEM
|
|
64
64
|
thor (0.18.1)
|
65
65
|
timed_lru (0.3.1)
|
66
66
|
timers (1.1.0)
|
67
|
-
tins (0.13.
|
67
|
+
tins (0.13.2)
|
68
68
|
yard (0.8.7.3)
|
69
69
|
zk (1.9.3)
|
70
70
|
logging (~> 1.7.2)
|
data/fluq-kafka.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = `git ls-files`.split("\n")
|
22
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
23
|
|
24
|
-
s.add_dependency "fluq", "~> #{s.version}"
|
24
|
+
s.add_dependency "fluq", "~> #{s.version.to_s.sub(/\d+$/, '0')}"
|
25
25
|
s.add_dependency "poseidon_cluster"
|
26
26
|
|
27
27
|
s.add_development_dependency "rake"
|
data/lib/fluq/input/kafka.rb
CHANGED
@@ -14,6 +14,8 @@ class FluQ::Input::Kafka < FluQ::Input::Base
|
|
14
14
|
# Default: 100 (100ms)
|
15
15
|
# @option options [Integer] :min_bytes smallest amount of data the server should send us.
|
16
16
|
# Default: 0 (send us data as soon as it is ready)
|
17
|
+
# @option options [Class] :consumer_class the consumer class to use.
|
18
|
+
# Ddefault: FluQ::Kafka::Consumer
|
17
19
|
#
|
18
20
|
# @raises [ArgumentError] when no topic provided
|
19
21
|
#
|
@@ -64,7 +66,7 @@ class FluQ::Input::Kafka < FluQ::Input::Base
|
|
64
66
|
protected
|
65
67
|
|
66
68
|
def consumer
|
67
|
-
@consumer ||=
|
69
|
+
@consumer ||= config[:consumer_class].new config[:group], config[:brokers], config[:zookeepers], config[:topic],
|
68
70
|
min_bytes: config[:min_bytes],
|
69
71
|
max_bytes: config[:max_bytes],
|
70
72
|
max_wait_ms: config[:max_wait_ms]
|
@@ -81,12 +83,16 @@ class FluQ::Input::Kafka < FluQ::Input::Base
|
|
81
83
|
max_bytes: (1024 * 1024),
|
82
84
|
max_wait_ms: 100,
|
83
85
|
brokers: ["localhost:9092"],
|
84
|
-
zookeepers: ["localhost:2181"]
|
86
|
+
zookeepers: ["localhost:2181"],
|
87
|
+
consumer_class: ::FluQ::Kafka::Consumer
|
88
|
+
|
85
89
|
end
|
86
90
|
|
87
91
|
def before_terminate
|
88
92
|
@consumer.close if @consumer
|
89
93
|
rescue ThreadError
|
94
|
+
ensure
|
95
|
+
@consumer = nil
|
90
96
|
end
|
91
97
|
|
92
98
|
end
|
data/lib/fluq/kafka.rb
CHANGED
data/lib/fluq/kafka/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe FluQ::Input::Kafka do
|
|
6
6
|
let(:actors) { [] }
|
7
7
|
|
8
8
|
let :mock_consumer do
|
9
|
-
double
|
9
|
+
double FluQ::Kafka::Consumer, claimed: [], fetch_loop: nil, close: true
|
10
10
|
end
|
11
11
|
|
12
12
|
def input(opts = {})
|
@@ -15,14 +15,25 @@ describe FluQ::Input::Kafka do
|
|
15
15
|
actor
|
16
16
|
end
|
17
17
|
|
18
|
-
before {
|
18
|
+
before { FluQ::Kafka::Consumer.stub new: mock_consumer }
|
19
19
|
after { actors.each &:terminate }
|
20
20
|
subject { input topic: "my-topic" }
|
21
21
|
|
22
22
|
it { should be_a(FluQ::Input::Base) }
|
23
23
|
its(:description) { should == "kafka:my-topic (fluq <- localhost:9092)" }
|
24
24
|
its(:name) { should == "kafka:my-topic" }
|
25
|
-
its(:config) { should == {
|
25
|
+
its(:config) { should == {
|
26
|
+
format: "json",
|
27
|
+
format_options: {},
|
28
|
+
group: "fluq",
|
29
|
+
min_bytes: 0,
|
30
|
+
max_bytes: 1048576,
|
31
|
+
max_wait_ms: 100,
|
32
|
+
brokers: ["localhost:9092"],
|
33
|
+
zookeepers: ["localhost:2181"],
|
34
|
+
topic: "my-topic",
|
35
|
+
consumer_class: FluQ::Kafka::Consumer,
|
36
|
+
}}
|
26
37
|
|
27
38
|
it 'should require a topic option' do
|
28
39
|
-> { input }.should raise_error(ArgumentError, /No topic provided/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluq-kafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluq
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/fluq-kafka.rb
|
126
126
|
- lib/fluq/input/kafka.rb
|
127
127
|
- lib/fluq/kafka.rb
|
128
|
+
- lib/fluq/kafka/consumer.rb
|
128
129
|
- lib/fluq/kafka/version.rb
|
129
130
|
- spec/fluq/input/kafka_spec.rb
|
130
131
|
- spec/fluq/kafka_spec.rb
|
@@ -150,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: 1.8.0
|
151
152
|
requirements: []
|
152
153
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.2.1
|
154
|
+
rubygems_version: 2.2.0.rc.1
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
157
|
summary: FluQ Kafka
|