Skip to content

Commit 863a59c

Browse files
author
Ale
committed
changed ambiguous method send for push
1 parent f4da935 commit 863a59c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ to your Gemfile.
2727
require 'kafka'
2828
producer = Kafka::Producer.new
2929
message = Kafka::Message.new("some random message content")
30-
producer.send(message)
30+
producer.push(message)
3131

3232
### Sending a sequence of messages
3333

3434
require 'kafka'
3535
producer = Kafka::Producer.new
3636
message1 = Kafka::Message.new("some random message content")
3737
message2 = Kafka::Message.new("some more content")
38-
producer.send([message1, message2])
38+
producer.push([message1, message2])
3939

4040
### Batching a bunch of messages using the block syntax
4141

4242
require 'kafka'
4343
producer = Kafka::Producer.new
4444
producer.batch do |messages|
45-
puts "Batching a send of multiple messages.."
46-
messages << Kafka::Message.new("first message to send")
47-
messages << Kafka::Message.new("second message to send")
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")
4848
end
4949

5050
* they will be sent all at once, after the block execution

lib/kafka/cli.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def publish!
2424
parse_args
2525
validate_config
2626
if config[:message]
27-
send(config, config.delete(:message))
27+
push(config, config.delete(:message))
2828
else
2929
publish(config)
3030
end
@@ -129,8 +129,8 @@ def string_to_compression(meth)
129129
end
130130
end
131131

132-
def send(options, message)
133-
Producer.new(options).send(Message.new(message))
132+
def push(options, message)
133+
Producer.new(options).push(Message.new(message))
134134
end
135135

136136
def publish(options)
@@ -143,7 +143,7 @@ def publish(options)
143143

144144
def publish_loop(producer)
145145
message = read_input
146-
producer.send(Message.new(message))
146+
producer.push(Message.new(message))
147147
end
148148

149149
def read_input

spec/cli_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
CLI.string_to_compression("no").should == Message::NO_COMPRESSION
128128
CLI.string_to_compression("gzip").should == Message::GZIP_COMPRESSION
129129
CLI.string_to_compression("snappy").should == Message::SNAPPY_COMPRESSION
130-
lambda { CLI.send(:string_to_compression,nil) }.should raise_error
130+
lambda { CLI.push(:string_to_compression,nil) }.should raise_error
131131
end
132132

133133
end

0 commit comments

Comments
 (0)