Class: Kafka::MultiProducer
- Inherits:
-
Object
- Object
- Kafka::MultiProducer
- Includes:
- IO
- Defined in:
- lib/kafka/multi_producer.rb
Constant Summary
Constants included from IO
Instance Attribute Summary
Attributes included from IO
#compression, #host, #port, #socket
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MultiProducer
constructor
A new instance of MultiProducer.
- #multi_push(producer_requests) ⇒ Object
- #push(topic, messages, options = {}) ⇒ Object
Methods included from IO
#connect, #disconnect, #read, #reconnect, #write
Constructor Details
#initialize(options = {}) ⇒ MultiProducer
Returns a new instance of MultiProducer.
19 20 21 22 23 24 |
# File 'lib/kafka/multi_producer.rb', line 19 def initialize(={}) self.host = [:host] || HOST self.port = [:port] || PORT self.compression = [:compression] || Message::NO_COMPRESSION self.connect(self.host, self.port) end |
Instance Method Details
#multi_push(producer_requests) ⇒ Object
31 32 33 |
# File 'lib/kafka/multi_producer.rb', line 31 def multi_push(producer_requests) self.write(Encoder.multiproduce(producer_requests, compression)) end |