Permalink
Browse files

changed ambiguous method send for push

  • Loading branch information...
Ale
Ale committed Mar 31, 2013
1 parent f4da935 commit 863a59c648c12fc0346d301ba2c8cad9307fd084
Showing with 10 additions and 10 deletions.
  1. +5 −5 README.md
  2. +4 −4 lib/kafka/cli.rb
  3. +1 −1 spec/cli_spec.rb
View
@@ -27,24 +27,24 @@ to your Gemfile.
require 'kafka'
producer = Kafka::Producer.new
message = Kafka::Message.new("some random message content")
- producer.send(message)
+ producer.push(message)
### Sending a sequence of messages
require 'kafka'
producer = Kafka::Producer.new
message1 = Kafka::Message.new("some random message content")
message2 = Kafka::Message.new("some more content")
- producer.send([message1, message2])
+ producer.push([message1, message2])
### Batching a bunch of messages using the block syntax
require 'kafka'
producer = Kafka::Producer.new
producer.batch do |messages|
- puts "Batching a send of multiple messages.."
- messages << Kafka::Message.new("first message to send")
- messages << Kafka::Message.new("second message to send")
+ puts "Batching a push of multiple messages.."
+ messages << Kafka::Message.new("first message to push")
+ messages << Kafka::Message.new("second message to push")
end
* they will be sent all at once, after the block execution
View
@@ -24,7 +24,7 @@ def publish!
parse_args
validate_config
if config[:message]
- send(config, config.delete(:message))
+ push(config, config.delete(:message))
else
publish(config)
end
@@ -129,8 +129,8 @@ def string_to_compression(meth)
end
end
- def send(options, message)
- Producer.new(options).send(Message.new(message))
+ def push(options, message)
+ Producer.new(options).push(Message.new(message))
end
def publish(options)
@@ -143,7 +143,7 @@ def publish(options)
def publish_loop(producer)
message = read_input
- producer.send(Message.new(message))
+ producer.push(Message.new(message))
end
def read_input
View
@@ -127,7 +127,7 @@
CLI.string_to_compression("no").should == Message::NO_COMPRESSION
CLI.string_to_compression("gzip").should == Message::GZIP_COMPRESSION
CLI.string_to_compression("snappy").should == Message::SNAPPY_COMPRESSION
- lambda { CLI.send(:string_to_compression,nil) }.should raise_error
+ lambda { CLI.push(:string_to_compression,nil) }.should raise_error
end
end

0 comments on commit 863a59c

Please sign in to comment.