kafka-rb 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -5
- data/lib/kafka/cli.rb +4 -4
- data/spec/cli_spec.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -27,7 +27,7 @@ to your Gemfile.
|
|
27
27
|
require 'kafka'
|
28
28
|
producer = Kafka::Producer.new
|
29
29
|
message = Kafka::Message.new("some random message content")
|
30
|
-
producer.
|
30
|
+
producer.push(message)
|
31
31
|
|
32
32
|
### Sending a sequence of messages
|
33
33
|
|
@@ -35,16 +35,16 @@ to your Gemfile.
|
|
35
35
|
producer = Kafka::Producer.new
|
36
36
|
message1 = Kafka::Message.new("some random message content")
|
37
37
|
message2 = Kafka::Message.new("some more content")
|
38
|
-
producer.
|
38
|
+
producer.push([message1, message2])
|
39
39
|
|
40
40
|
### Batching a bunch of messages using the block syntax
|
41
41
|
|
42
42
|
require 'kafka'
|
43
43
|
producer = Kafka::Producer.new
|
44
44
|
producer.batch do |messages|
|
45
|
-
puts "Batching a
|
46
|
-
messages << Kafka::Message.new("first message to
|
47
|
-
messages << Kafka::Message.new("second message to
|
45
|
+
puts "Batching a push of multiple messages.."
|
46
|
+
messages << Kafka::Message.new("first message to push")
|
47
|
+
messages << Kafka::Message.new("second message to push")
|
48
48
|
end
|
49
49
|
|
50
50
|
* they will be sent all at once, after the block execution
|
data/lib/kafka/cli.rb
CHANGED
@@ -24,7 +24,7 @@ module Kafka
|
|
24
24
|
parse_args
|
25
25
|
validate_config
|
26
26
|
if config[:message]
|
27
|
-
|
27
|
+
push(config, config.delete(:message))
|
28
28
|
else
|
29
29
|
publish(config)
|
30
30
|
end
|
@@ -129,8 +129,8 @@ module Kafka
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
def
|
133
|
-
Producer.new(options).
|
132
|
+
def push(options, message)
|
133
|
+
Producer.new(options).push(Message.new(message))
|
134
134
|
end
|
135
135
|
|
136
136
|
def publish(options)
|
@@ -143,7 +143,7 @@ module Kafka
|
|
143
143
|
|
144
144
|
def publish_loop(producer)
|
145
145
|
message = read_input
|
146
|
-
producer.
|
146
|
+
producer.push(Message.new(message))
|
147
147
|
end
|
148
148
|
|
149
149
|
def read_input
|
data/spec/cli_spec.rb
CHANGED
@@ -127,7 +127,7 @@ describe CLI do
|
|
127
127
|
CLI.string_to_compression("no").should == Message::NO_COMPRESSION
|
128
128
|
CLI.string_to_compression("gzip").should == Message::GZIP_COMPRESSION
|
129
129
|
CLI.string_to_compression("snappy").should == Message::SNAPPY_COMPRESSION
|
130
|
-
lambda { CLI.
|
130
|
+
lambda { CLI.push(:string_to_compression,nil) }.should raise_error
|
131
131
|
end
|
132
132
|
|
133
133
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kafka-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire: kafka-rb
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-03-
|
15
|
+
date: 2013-03-31 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
segments:
|
84
84
|
- 0
|
85
|
-
hash: -
|
85
|
+
hash: -2789972308645637965
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
none: false
|
88
88
|
requirements:
|