Class: Kafka::Producer
Constant Summary
Constants included from IO
Instance Attribute Summary collapse
-
#partition ⇒ Object
Returns the value of attribute partition.
-
#topic ⇒ Object
Returns the value of attribute topic.
Attributes included from IO
#compression, #host, #port, #socket
Instance Method Summary collapse
- #batch(&block) ⇒ Object
-
#initialize(options = {}) ⇒ Producer
constructor
A new instance of Producer.
- #push(messages) ⇒ Object
Methods included from IO
#connect, #disconnect, #read, #reconnect, #write
Constructor Details
#initialize(options = {}) ⇒ Producer
Returns a new instance of Producer.
22 23 24 25 26 27 28 29 |
# File 'lib/kafka/producer.rb', line 22 def initialize( = {}) self.topic = [:topic] || "test" self.partition = [:partition] || 0 self.host = [:host] || HOST self.port = [:port] || PORT self.compression = [:compression] || Message::NO_COMPRESSION self.connect(self.host, self.port) end |
Instance Attribute Details
#partition ⇒ Object
Returns the value of attribute partition.
20 21 22 |
# File 'lib/kafka/producer.rb', line 20 def partition @partition end |
#topic ⇒ Object
Returns the value of attribute topic.
20 21 22 |
# File 'lib/kafka/producer.rb', line 20 def topic @topic end |