fluq-kafka 0.8.0
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 +7 -0
- data/.bundle/install.log +23 -0
- data/.gitignore +4 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +88 -0
- data/README.md +28 -0
- data/Rakefile +18 -0
- data/fluq-kafka.gemspec +32 -0
- data/lib/fluq-kafka.rb +1 -0
- data/lib/fluq/input/kafka.rb +93 -0
- data/lib/fluq/kafka.rb +8 -0
- data/lib/fluq/kafka/version.rb +5 -0
- data/spec/fluq/input/kafka_spec.rb +40 -0
- data/spec/fluq/kafka_spec.rb +14 -0
- data/spec/scenario/.gitkeep +0 -0
- data/spec/spec_helper.rb +16 -0
- metadata +158 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 14bf6c533a3bc8171681579e6b2bd9d5c578424c
|
|
4
|
+
data.tar.gz: ddaa619f61a3d08a690ebbf987d8d3edadfad014
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a8afc4eebc8ab90412d3eb6a16c93db5b8d4d91198eb43dd15d3084da622bf3398cc1aa7c17a1dae6241d2c998cc10f6c7705de622c6bbbb75dd072ccfa37adc
|
|
7
|
+
data.tar.gz: b5763d4b2b25ff2cbf5aa8afa657938d8f2114208ee14395b214bc9b97175adab136ea718c4b797186c46bdb41f5beb4c5d986c21e6019ab9b24b2036a6b10ec
|
data/.bundle/install.log
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Logfile created on 2014-01-18 14:14:05 +0000 by logger.rb/44203
|
|
2
|
+
I, [2014-01-18T14:14:05.461408 #26543] INFO -- : 0: rake (10.1.1) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/rake-10.1.1.gemspec
|
|
3
|
+
I, [2014-01-18T14:14:05.461973 #26543] INFO -- : 0: bundler (1.5.0) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/bundler-1.5.0.gemspec
|
|
4
|
+
I, [2014-01-18T14:14:05.462372 #26543] INFO -- : 0: timers (1.1.0) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/timers-1.1.0.gemspec
|
|
5
|
+
I, [2014-01-18T14:14:05.462778 #26543] INFO -- : 0: celluloid (0.15.2) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/celluloid-0.15.2.gemspec
|
|
6
|
+
I, [2014-01-18T14:14:05.463185 #26543] INFO -- : 0: nio4r (1.0.0) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/nio4r-1.0.0.gemspec
|
|
7
|
+
I, [2014-01-18T14:14:05.463590 #26543] INFO -- : 0: celluloid-io (0.15.0) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/celluloid-io-0.15.0.gemspec
|
|
8
|
+
I, [2014-01-18T14:14:05.464023 #26543] INFO -- : 0: diff-lcs (1.2.5) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/diff-lcs-1.2.5.gemspec
|
|
9
|
+
I, [2014-01-18T14:14:05.464449 #26543] INFO -- : 0: multi_json (1.8.4) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/multi_json-1.8.4.gemspec
|
|
10
|
+
I, [2014-01-18T14:14:05.464867 #26543] INFO -- : 0: timed_lru (0.3.1) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/timed_lru-0.3.1.gemspec
|
|
11
|
+
I, [2014-01-18T14:14:05.540863 #26543] INFO -- : 0: fluq (0.8.0) from /home/dim/.rvm/gems/ruby-2.1.0/bundler/gems/fluq-87e8d5d493b0/fluq.gemspec
|
|
12
|
+
I, [2014-01-18T14:14:06.855386 #26543] INFO -- : 0: poseidon (0.0.4) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/poseidon-0.0.4.gemspec
|
|
13
|
+
I, [2014-01-18T14:14:06.856594 #26543] INFO -- : 0: little-plugger (1.1.3) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/little-plugger-1.1.3.gemspec
|
|
14
|
+
I, [2014-01-18T14:14:06.857551 #26543] INFO -- : 0: logging (1.7.2) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/logging-1.7.2.gemspec
|
|
15
|
+
I, [2014-01-18T14:14:06.858502 #26543] INFO -- : 0: zookeeper (1.4.8) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/zookeeper-1.4.8.gemspec
|
|
16
|
+
I, [2014-01-18T14:14:06.859447 #26543] INFO -- : 0: zk (1.9.3) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/zk-1.9.3.gemspec
|
|
17
|
+
I, [2014-01-18T14:14:08.458286 #26543] INFO -- : 0: poseidon_cluster (0.0.2) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/poseidon_cluster-0.0.2.gemspec
|
|
18
|
+
I, [2014-01-18T14:14:08.467851 #26543] INFO -- : 0: fluq-kafka (0.8.0) from /home/dim/Work/fluq-kafka/fluq-kafka.gemspec
|
|
19
|
+
I, [2014-01-18T14:14:08.468749 #26543] INFO -- : 0: rspec-core (2.14.7) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/rspec-core-2.14.7.gemspec
|
|
20
|
+
I, [2014-01-18T14:14:08.469579 #26543] INFO -- : 0: rspec-expectations (2.14.4) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/rspec-expectations-2.14.4.gemspec
|
|
21
|
+
I, [2014-01-18T14:14:08.470275 #26543] INFO -- : 0: rspec-mocks (2.14.4) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/rspec-mocks-2.14.4.gemspec
|
|
22
|
+
I, [2014-01-18T14:14:08.470843 #26543] INFO -- : 0: rspec (2.14.1) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/rspec-2.14.1.gemspec
|
|
23
|
+
I, [2014-01-18T14:14:08.471430 #26543] INFO -- : 0: yard (0.8.7.3) from /home/dim/.rvm/gems/ruby-2.1.0/specifications/yard-0.8.7.3.gemspec
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: https://github.com/dim/poseidon.git
|
|
3
|
+
revision: f853e8f07a6f2ff4a520d3f7e1dac030453a18ed
|
|
4
|
+
specs:
|
|
5
|
+
poseidon (0.0.4)
|
|
6
|
+
|
|
7
|
+
PATH
|
|
8
|
+
remote: .
|
|
9
|
+
specs:
|
|
10
|
+
fluq-kafka (0.8.0)
|
|
11
|
+
fluq (~> 0.8.0)
|
|
12
|
+
poseidon_cluster
|
|
13
|
+
|
|
14
|
+
GEM
|
|
15
|
+
remote: https://rubygems.org/
|
|
16
|
+
specs:
|
|
17
|
+
celluloid (0.15.2)
|
|
18
|
+
timers (~> 1.1.0)
|
|
19
|
+
celluloid-io (0.15.0)
|
|
20
|
+
celluloid (>= 0.15.0)
|
|
21
|
+
nio4r (>= 0.5.0)
|
|
22
|
+
coveralls (0.7.0)
|
|
23
|
+
multi_json (~> 1.3)
|
|
24
|
+
rest-client
|
|
25
|
+
simplecov (>= 0.7)
|
|
26
|
+
term-ansicolor
|
|
27
|
+
thor
|
|
28
|
+
diff-lcs (1.2.5)
|
|
29
|
+
docile (1.1.2)
|
|
30
|
+
fluq (0.8.0)
|
|
31
|
+
celluloid-io (~> 0.15.0)
|
|
32
|
+
multi_json
|
|
33
|
+
timed_lru
|
|
34
|
+
little-plugger (1.1.3)
|
|
35
|
+
logging (1.7.2)
|
|
36
|
+
little-plugger (>= 1.1.3)
|
|
37
|
+
mime-types (2.1)
|
|
38
|
+
multi_json (1.8.4)
|
|
39
|
+
nio4r (1.0.0)
|
|
40
|
+
nio4r (1.0.0-java)
|
|
41
|
+
poseidon_cluster (0.0.5)
|
|
42
|
+
poseidon
|
|
43
|
+
zk
|
|
44
|
+
rake (10.1.1)
|
|
45
|
+
rest-client (1.6.7)
|
|
46
|
+
mime-types (>= 1.16)
|
|
47
|
+
rspec (2.14.1)
|
|
48
|
+
rspec-core (~> 2.14.0)
|
|
49
|
+
rspec-expectations (~> 2.14.0)
|
|
50
|
+
rspec-mocks (~> 2.14.0)
|
|
51
|
+
rspec-core (2.14.7)
|
|
52
|
+
rspec-expectations (2.14.4)
|
|
53
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
54
|
+
rspec-mocks (2.14.4)
|
|
55
|
+
simplecov (0.8.2)
|
|
56
|
+
docile (~> 1.1.0)
|
|
57
|
+
multi_json
|
|
58
|
+
simplecov-html (~> 0.8.0)
|
|
59
|
+
simplecov-html (0.8.0)
|
|
60
|
+
slyphon-log4j (1.2.15)
|
|
61
|
+
slyphon-zookeeper_jar (3.3.5-java)
|
|
62
|
+
term-ansicolor (1.2.2)
|
|
63
|
+
tins (~> 0.8)
|
|
64
|
+
thor (0.18.1)
|
|
65
|
+
timed_lru (0.3.1)
|
|
66
|
+
timers (1.1.0)
|
|
67
|
+
tins (0.13.1)
|
|
68
|
+
yard (0.8.7.3)
|
|
69
|
+
zk (1.9.3)
|
|
70
|
+
logging (~> 1.7.2)
|
|
71
|
+
zookeeper (~> 1.4.0)
|
|
72
|
+
zookeeper (1.4.8)
|
|
73
|
+
zookeeper (1.4.8-java)
|
|
74
|
+
slyphon-log4j (= 1.2.15)
|
|
75
|
+
slyphon-zookeeper_jar (= 3.3.5)
|
|
76
|
+
|
|
77
|
+
PLATFORMS
|
|
78
|
+
java
|
|
79
|
+
ruby
|
|
80
|
+
|
|
81
|
+
DEPENDENCIES
|
|
82
|
+
bundler
|
|
83
|
+
coveralls
|
|
84
|
+
fluq-kafka!
|
|
85
|
+
poseidon!
|
|
86
|
+
rake
|
|
87
|
+
rspec
|
|
88
|
+
yard
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# FluQ - Kafka [](https://travis-ci.org/bsm/fluq-kafka) [](https://coveralls.io/r/bsm/fluq-kafka)
|
|
2
|
+
|
|
3
|
+
Kafka 0.8+ input for FluQ.
|
|
4
|
+
|
|
5
|
+
## Licence
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Copyright (c) 2014 Black Square Media
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
11
|
+
a copy of this software and associated documentation files (the
|
|
12
|
+
"Software"), to deal in the Software without restriction, including
|
|
13
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
14
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
15
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
16
|
+
the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be
|
|
19
|
+
included in all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
24
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
25
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
27
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
3
|
+
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
6
|
+
|
|
7
|
+
require 'yard'
|
|
8
|
+
require 'yard/rake/yardoc_task'
|
|
9
|
+
YARD::Rake::YardocTask.new
|
|
10
|
+
|
|
11
|
+
require 'coveralls/rake/task'
|
|
12
|
+
Coveralls::RakeTask.new
|
|
13
|
+
namespace :spec do
|
|
14
|
+
task coveralls: [:spec, 'coveralls:push']
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc 'Default: run specs.'
|
|
18
|
+
task :default => :spec
|
data/fluq-kafka.gemspec
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
4
|
+
require "fluq/kafka/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.required_ruby_version = '>= 1.9.1'
|
|
8
|
+
s.required_rubygems_version = ">= 1.8.0"
|
|
9
|
+
|
|
10
|
+
s.name = File.basename(__FILE__, '.gemspec')
|
|
11
|
+
s.summary = "FluQ Kafka"
|
|
12
|
+
s.description = "Kafka plugin for FluQ"
|
|
13
|
+
s.version = FluQ::Kafka::VERSION.dup
|
|
14
|
+
|
|
15
|
+
s.authors = ["Black Square Media"]
|
|
16
|
+
s.email = "info@blacksquaremedia.com"
|
|
17
|
+
s.homepage = "https://github.com/bsm/fluq-kafka"
|
|
18
|
+
|
|
19
|
+
s.require_path = 'lib'
|
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
21
|
+
s.files = `git ls-files`.split("\n")
|
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
23
|
+
|
|
24
|
+
s.add_dependency "fluq", "~> #{s.version}"
|
|
25
|
+
s.add_dependency "poseidon_cluster"
|
|
26
|
+
|
|
27
|
+
s.add_development_dependency "rake"
|
|
28
|
+
s.add_development_dependency "bundler"
|
|
29
|
+
s.add_development_dependency "rspec"
|
|
30
|
+
s.add_development_dependency "yard"
|
|
31
|
+
s.add_development_dependency "coveralls"
|
|
32
|
+
end
|
data/lib/fluq-kafka.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'fluq/kafka'
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
class FluQ::Input::Kafka < FluQ::Input::Base
|
|
2
|
+
|
|
3
|
+
# Constructor.
|
|
4
|
+
# @option options [String] :topic the name of the topic to consume
|
|
5
|
+
# @option options [String] :group
|
|
6
|
+
# The unique consumer group name. Each topic message is consumed only once by members of the same group.
|
|
7
|
+
# If you have multiple thread/process instances running, make sure you assign them the same group name to
|
|
8
|
+
# ensure events are not duplicated.
|
|
9
|
+
# @option options [String] :brokers an array of "HOST:PORT" broker addresses, e.g. ["localhost:9092"]
|
|
10
|
+
# @option options [String] :zookeepers an array of "HOST:PORT" zookeeper addresses, e.g. ["localhost:2181"]
|
|
11
|
+
# @option options [Integer] :max_bytes maximum number of bytes to fetch
|
|
12
|
+
# Default: 1048576 (1MB)
|
|
13
|
+
# @option options [Integer] :max_wait_ms how long to block until the server sends us data.
|
|
14
|
+
# Default: 100 (100ms)
|
|
15
|
+
# @option options [Integer] :min_bytes smallest amount of data the server should send us.
|
|
16
|
+
# Default: 0 (send us data as soon as it is ready)
|
|
17
|
+
#
|
|
18
|
+
# @raises [ArgumentError] when no topic provided
|
|
19
|
+
#
|
|
20
|
+
# @example
|
|
21
|
+
#
|
|
22
|
+
# FluQ::Input::Kafka.new handlers,
|
|
23
|
+
# topic: "page-views",
|
|
24
|
+
# group: "fluq",
|
|
25
|
+
# brokers: ["localhost:9092"],
|
|
26
|
+
# zookeepers: ["localhost:2181"]
|
|
27
|
+
def initialize(*)
|
|
28
|
+
super
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @return [String] short name
|
|
32
|
+
def name
|
|
33
|
+
"kafka:#{config[:topic]}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @return [String] descriptive name
|
|
37
|
+
def description
|
|
38
|
+
"#{name} (#{config[:group]} <- #{config[:brokers].join(',')})"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Start the loop
|
|
42
|
+
def run
|
|
43
|
+
super
|
|
44
|
+
|
|
45
|
+
consumer.fetch_loop do |partition, bulk|
|
|
46
|
+
process partition, bulk
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Processes messages
|
|
51
|
+
# @param [Integer] partition
|
|
52
|
+
# @param [Array<Poseidon::Message>] messages
|
|
53
|
+
def process(partition, messages)
|
|
54
|
+
events = []
|
|
55
|
+
messages.each do |m|
|
|
56
|
+
events.concat format.parse(m.value)
|
|
57
|
+
end
|
|
58
|
+
events.each do |event|
|
|
59
|
+
event.meta.update topic: config[:topic], partition: partition
|
|
60
|
+
end
|
|
61
|
+
worker.process events
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
protected
|
|
65
|
+
|
|
66
|
+
def consumer
|
|
67
|
+
@consumer ||= ::Poseidon::ConsumerGroup.new config[:group], config[:brokers], config[:zookeepers], config[:topic],
|
|
68
|
+
min_bytes: config[:min_bytes],
|
|
69
|
+
max_bytes: config[:max_bytes],
|
|
70
|
+
max_wait_ms: config[:max_wait_ms]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def configure
|
|
74
|
+
raise ArgumentError, 'No topic provided, make sure you pass a :topic option' unless config[:topic]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def defaults
|
|
78
|
+
super.merge \
|
|
79
|
+
group: "fluq",
|
|
80
|
+
min_bytes: 0,
|
|
81
|
+
max_bytes: (1024 * 1024),
|
|
82
|
+
max_wait_ms: 100,
|
|
83
|
+
brokers: ["localhost:9092"],
|
|
84
|
+
zookeepers: ["localhost:2181"]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def before_terminate
|
|
88
|
+
@consumer.close if @consumer
|
|
89
|
+
rescue ThreadError
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
|
data/lib/fluq/kafka.rb
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FluQ::Input::Kafka do
|
|
4
|
+
|
|
5
|
+
let(:message) { Poseidon::Message.new value: %({"a":1,"b":2}) }
|
|
6
|
+
let(:actors) { [] }
|
|
7
|
+
|
|
8
|
+
let :mock_consumer do
|
|
9
|
+
double Poseidon::ConsumerGroup, claimed: [], fetch_loop: nil, close: true
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def input(opts = {})
|
|
13
|
+
actor = described_class.new "my-feed", [[FluQ::Handler::Test]], opts
|
|
14
|
+
actors << actor
|
|
15
|
+
actor
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
before { Poseidon::ConsumerGroup.stub new: mock_consumer }
|
|
19
|
+
after { actors.each &:terminate }
|
|
20
|
+
subject { input topic: "my-topic" }
|
|
21
|
+
|
|
22
|
+
it { should be_a(FluQ::Input::Base) }
|
|
23
|
+
its(:description) { should == "kafka:my-topic (fluq <- localhost:9092)" }
|
|
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"} }
|
|
26
|
+
|
|
27
|
+
it 'should require a topic option' do
|
|
28
|
+
-> { input }.should raise_error(ArgumentError, /No topic provided/)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should fetch messages' do
|
|
32
|
+
mock_consumer.should_receive(:fetch_loop).and_yield(3, [message]*10)
|
|
33
|
+
subject.worker.should have(1).handlers
|
|
34
|
+
subject.worker.handlers.first.should have(10).events
|
|
35
|
+
event = subject.worker.handlers.first.events.first
|
|
36
|
+
event.should == {"a"=>1,"b"=>2}
|
|
37
|
+
event.meta.should == {topic: "my-topic", partition: 3}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FluQ::Kafka do
|
|
4
|
+
|
|
5
|
+
it 'should force celluloid sockets' do
|
|
6
|
+
sock = double(Celluloid::IO::TCPSocket)
|
|
7
|
+
::TCPSocket.should_not_receive(:new)
|
|
8
|
+
Celluloid::IO::TCPSocket.should_receive(:new).and_return(sock)
|
|
9
|
+
|
|
10
|
+
conn = Poseidon::Connection.new "localhost", 9092, "client-id"
|
|
11
|
+
conn.send(:ensure_connected).should == sock
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
File without changes
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ENV['FLUQ_ROOT'] ||= File.expand_path("../scenario/", __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'rspec'
|
|
5
|
+
require 'coveralls'
|
|
6
|
+
Coveralls.wear_merged!
|
|
7
|
+
|
|
8
|
+
require 'fluq/kafka'
|
|
9
|
+
require 'fluq/testing'
|
|
10
|
+
|
|
11
|
+
FluQ.logger = Logger.new(FluQ.root.join("log", "fluq.log").to_s)
|
|
12
|
+
RSpec.configure do |c|
|
|
13
|
+
c.after do
|
|
14
|
+
FileUtils.rm_rf FluQ.root.join('log/kafka').to_s
|
|
15
|
+
end
|
|
16
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fluq-kafka
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.8.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Black Square Media
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: fluq
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.8.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.8.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: poseidon_cluster
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: bundler
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: yard
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: coveralls
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
description: Kafka plugin for FluQ
|
|
112
|
+
email: info@blacksquaremedia.com
|
|
113
|
+
executables: []
|
|
114
|
+
extensions: []
|
|
115
|
+
extra_rdoc_files: []
|
|
116
|
+
files:
|
|
117
|
+
- ".bundle/install.log"
|
|
118
|
+
- ".gitignore"
|
|
119
|
+
- ".travis.yml"
|
|
120
|
+
- Gemfile
|
|
121
|
+
- Gemfile.lock
|
|
122
|
+
- README.md
|
|
123
|
+
- Rakefile
|
|
124
|
+
- fluq-kafka.gemspec
|
|
125
|
+
- lib/fluq-kafka.rb
|
|
126
|
+
- lib/fluq/input/kafka.rb
|
|
127
|
+
- lib/fluq/kafka.rb
|
|
128
|
+
- lib/fluq/kafka/version.rb
|
|
129
|
+
- spec/fluq/input/kafka_spec.rb
|
|
130
|
+
- spec/fluq/kafka_spec.rb
|
|
131
|
+
- spec/scenario/.gitkeep
|
|
132
|
+
- spec/scenario/log/.gitkeep
|
|
133
|
+
- spec/spec_helper.rb
|
|
134
|
+
homepage: https://github.com/bsm/fluq-kafka
|
|
135
|
+
licenses: []
|
|
136
|
+
metadata: {}
|
|
137
|
+
post_install_message:
|
|
138
|
+
rdoc_options: []
|
|
139
|
+
require_paths:
|
|
140
|
+
- lib
|
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: 1.9.1
|
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
|
+
requirements:
|
|
148
|
+
- - ">="
|
|
149
|
+
- !ruby/object:Gem::Version
|
|
150
|
+
version: 1.8.0
|
|
151
|
+
requirements: []
|
|
152
|
+
rubyforge_project:
|
|
153
|
+
rubygems_version: 2.2.1
|
|
154
|
+
signing_key:
|
|
155
|
+
specification_version: 4
|
|
156
|
+
summary: FluQ Kafka
|
|
157
|
+
test_files: []
|
|
158
|
+
has_rdoc:
|