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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14bf6c533a3bc8171681579e6b2bd9d5c578424c
4
- data.tar.gz: ddaa619f61a3d08a690ebbf987d8d3edadfad014
3
+ metadata.gz: 209affc0c927d251efc91a30c18cb52ddbda3827
4
+ data.tar.gz: 6b496c7f488346c6bb8792d1c3f7a1dd32da2f79
5
5
  SHA512:
6
- metadata.gz: a8afc4eebc8ab90412d3eb6a16c93db5b8d4d91198eb43dd15d3084da622bf3398cc1aa7c17a1dae6241d2c998cc10f6c7705de622c6bbbb75dd072ccfa37adc
7
- data.tar.gz: b5763d4b2b25ff2cbf5aa8afa657938d8f2114208ee14395b214bc9b97175adab136ea718c4b797186c46bdb41f5beb4c5d986c21e6019ab9b24b2036a6b10ec
6
+ metadata.gz: c82cdf855b4d1e11ab55e0b64b8c389527521d6d6c157522adc8524a6047f4b7d6ebd29ee11e5864243ae9aace51b5fbdf5f185e295f02672a21585400d57ca4
7
+ data.tar.gz: d2a0e5989f104b778098c42d4d866ccd96819d9f70bcd352ababbb2aebcc4edf25cfac9f15249ddcc6070d6cf38a4c716570a85a4f2989a4eccc938c2528218d
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- fluq-kafka (0.8.0)
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.2)
30
- fluq (0.8.0)
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.5)
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.4)
52
+ rspec-expectations (2.14.5)
53
53
  diff-lcs (>= 1.1.3, < 2.0)
54
- rspec-mocks (2.14.4)
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.1)
67
+ tins (0.13.2)
68
68
  yard (0.8.7.3)
69
69
  zk (1.9.3)
70
70
  logging (~> 1.7.2)
@@ -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"
@@ -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 ||= ::Poseidon::ConsumerGroup.new config[:group], config[:brokers], config[:zookeepers], config[:topic],
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
@@ -1,8 +1,5 @@
1
1
  require 'fluq'
2
2
  require 'fluq/kafka/version'
3
- require 'poseidon_cluster'
3
+ require 'fluq/kafka/consumer'
4
4
  require 'fluq/input/kafka'
5
5
 
6
- class Poseidon::Connection
7
- TCPSocket = Celluloid::IO::TCPSocket
8
- end
@@ -0,0 +1,13 @@
1
+ require 'poseidon_cluster'
2
+
3
+ class Poseidon::Connection
4
+ TCPSocket = Celluloid::IO::TCPSocket
5
+ end
6
+
7
+ module FluQ
8
+ module Kafka
9
+ class Consumer < Poseidon::ConsumerGroup
10
+ end
11
+ end
12
+ end
13
+
@@ -1,5 +1,5 @@
1
1
  module FluQ
2
2
  module Kafka
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.1"
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ describe FluQ::Input::Kafka do
6
6
  let(:actors) { [] }
7
7
 
8
8
  let :mock_consumer do
9
- double Poseidon::ConsumerGroup, claimed: [], fetch_loop: nil, close: true
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 { Poseidon::ConsumerGroup.stub new: mock_consumer }
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 == {format: "json", format_options: {}, group: "fluq", min_bytes: 0, max_bytes: 1048576, max_wait_ms: 100, brokers: ["localhost:9092"], zookeepers: ["localhost:2181"], topic: "my-topic"} }
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.0
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-01-30 00:00:00.000000000 Z
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