Class: Zkafka::Client
- Inherits:
-
Object
- Object
- Zkafka::Client
- Defined in:
- lib/zkafka/client.rb
Instance Attribute Summary collapse
-
#kafka_brokers ⇒ Object
readonly
Returns the value of attribute kafka_brokers.
Instance Method Summary collapse
-
#initialize(conn) ⇒ Client
constructor
A new instance of Client.
- #produce(messages, opts = {}) ⇒ Object
Constructor Details
#initialize(conn) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 |
# File 'lib/zkafka/client.rb', line 13 def initialize(conn) @zk = ZK.new conn watch_brokers read_brokers create_kafka end |
Instance Attribute Details
#kafka_brokers ⇒ Object (readonly)
Returns the value of attribute kafka_brokers.
11 12 13 |
# File 'lib/zkafka/client.rb', line 11 def kafka_brokers @kafka_brokers end |
Instance Method Details
#produce(messages, opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/zkafka/client.rb', line 20 def produce(, opts = {}) producer = @kafka.producer = Array() .each do || opts[:topic] = .topic producer.produce(., opts) end producer. end |