em-kafka 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzM5ZGZjMjg0YzI4MTg4NGZiYzk2NTM2Y2Q3ODI5ZTFmYzQwMmMzMg==
4
+ M2MxNTA3Y2RmYjQ1Y2Q2YjQxYWVmN2IzMjA1MDdjZGZkYjdiZjc5Yg==
5
5
  data.tar.gz: !binary |-
6
- ZjA2NDFhYWU1NDY0NTIzNmQ2MWY2YjJmZDI2YmViODAyZjNiYjBmMg==
6
+ MmZhYTk0NjhmN2FmMGI5ZWUwYWFjZjdmNGRlZmMwMTQyYWVhZTE3OA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWI4N2FiODA4ZjZhZDQ2YmJhZWUzZDY2NjA1YjY0NTRjN2Y2YjBiZGFiNGRk
10
- ZDFmZDU2NzdlY2U0YzFmNWEzYjlhYjI0MTVkODE2YWQzOWIxOGZjN2U3NDFj
11
- ZmM5ODMxZDE4OTU4ZmZmODBkODU1ZjhmNWI0ZDFjZmQ5YTgzMmU=
9
+ NzZiNzg5YTc4ZjkyZjZiMDcyN2VhNTMxZDVjYzA0OWY0MDIyZTdlYTkwNjY0
10
+ ZTlhN2NiM2Q0ZmI5MmZjMjgzYWQ3YTMwZjU2YzBlOTBlMzU2YzNmOTM1N2I3
11
+ MDFiMDk2MTU3NTA5YzYxYmRlMjUyYzgxYmRkNzBiNWI4ZGVlNDk=
12
12
  data.tar.gz: !binary |-
13
- ZjQ1ZDlmNmI5MDljNTUwNGI5M2JhYzJiNmIzMjJkMGMyNTg1ODNiMDZjMjBj
14
- MmQ1M2M3NjM1MjNlYmNhODU3NzhmMjc2YTUzNTg0NGU4NjA0ZjQ2ZWJmYTI3
15
- NjhhNGM2OThjOGYxZWFhMDg5NWNmMGI4NzZiNjUwZWI2ODY2ZmE=
13
+ NTcxYTI3NTc2NDYzMjY4NGU2OTc0ZmNlYzY3N2JkMzJjMmQ3OTg0NTZkZmRl
14
+ ZDI4ZTZjNzdhYmI5MWM1MTNlYzE5OWMwNTQ4OTRmMWQ1YmFlODYyZjJkMmMz
15
+ NjkzZmRlZjY3MWZhYjBjODAxODU3OTU3MWU2MmY2NjUyZWQyMjM=
data/Gemfile.lock CHANGED
@@ -1,15 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- em-kafka (0.0.1)
5
- eventmachine (>= 1.0.0.beta.4)
4
+ em-kafka (0.0.2)
5
+ eventmachine-le (>= 1.1.5)
6
6
  yajl-ruby (>= 0.8.2)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
11
  diff-lcs (1.1.3)
12
- eventmachine (1.0.0.beta.4)
12
+ eventmachine-le (1.1.5)
13
+ rake (10.1.0)
13
14
  rspec (2.6.0)
14
15
  rspec-core (~> 2.6.0)
15
16
  rspec-expectations (~> 2.6.0)
@@ -24,5 +25,7 @@ PLATFORMS
24
25
  ruby
25
26
 
26
27
  DEPENDENCIES
28
+ bundler
27
29
  em-kafka!
30
+ rake
28
31
  rspec (~> 2.6.0)
data/em-kafka.gemspec CHANGED
@@ -17,5 +17,8 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_dependency "eventmachine-le", ">= 1.1.5"
19
19
  s.add_dependency "yajl-ruby", ">= 0.8.2"
20
+
21
+ s.add_development_dependency "rake"
22
+ s.add_development_dependency "bundler"
20
23
  s.add_development_dependency "rspec", "~> 2.6.0"
21
24
  end
data/lib/em-kafka.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "eventmachine"
1
+ require "eventmachine-le"
2
2
  require "logger"
3
3
  require "uri"
4
4
  require "yajl"
@@ -39,14 +39,15 @@ module EventMachine
39
39
 
40
40
  def parse(frame)
41
41
  i = 0
42
+ messages = []
42
43
  while i <= frame.length do
43
44
  break unless message_size = frame[i, 4].unpack("N").first
44
45
  message_data = frame[i, message_size + 4]
45
46
  message = Kafka::Message.decode(message_size, message_data)
46
47
  i += message_size + 4
47
- @block.call(message)
48
+ messages << message
48
49
  end
49
-
50
+ @block.call(messages) unless messages.empty?
50
51
  advance_offset(i)
51
52
  reset
52
53
  end
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module Kafka
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -4,8 +4,8 @@ describe EM::Kafka::Parser do
4
4
  describe "parse" do
5
5
  it "parses messages from newline boundaries across packets" do
6
6
  messages = []
7
- parser = EM::Kafka::Parser.new do |message|
8
- messages << message
7
+ parser = EM::Kafka::Parser.new do |msgs|
8
+ messages.concat(msgs)
9
9
  end
10
10
 
11
11
  message_1 = EM::Kafka::Message.new("foo").encode
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keene
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.2
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'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement