Class: Hermann::Discovery::Metadata
- Inherits:
-
Object
- Object
- Hermann::Discovery::Metadata
- Defined in:
- lib/hermann/discovery/metadata.rb
Defined Under Namespace
Classes: Broker, Partition, Topic
Constant Summary collapse
- DEFAULT_TIMEOUT_MS =
2_000
Instance Method Summary collapse
-
#brokers ⇒ Object
=> [{:id=>3, :host=>“kafka3.alpha4.sac1.zdsys.com”, :port=>9092], :topics => :leader_id=>3, :replica_ids=>[3, 1], :isr_ids=>[3, 1]}}.
-
#initialize(brokers, options = {}) ⇒ Metadata
constructor
A new instance of Metadata.
- #topic(t) ⇒ Object
- #topics ⇒ Object
Constructor Details
#initialize(brokers, options = {}) ⇒ Metadata
Returns a new instance of Metadata.
21 22 23 24 25 |
# File 'lib/hermann/discovery/metadata.rb', line 21 def initialize(brokers, = {}) raise "this is an MRI api only!" if Hermann.jruby? @internal = Hermann::Provider::RDKafka::Producer.new(brokers) @timeout = [:timeout] || DEFAULT_TIMEOUT_MS end |
Instance Method Details
#brokers ⇒ Object
=> [{:id=>3, :host=>“kafka3.alpha4.sac1.zdsys.com”, :port=>9092],
:topics => {"testtopic"=>[{:id=>0, :leader_id=>3, :replica_ids=>[3, 1], :isr_ids=>[3, 1]}}}
32 33 34 |
# File 'lib/hermann/discovery/metadata.rb', line 32 def brokers (@internal.(nil, @timeout)) end |
#topic(t) ⇒ Object
36 37 38 |
# File 'lib/hermann/discovery/metadata.rb', line 36 def topic(t) get_topics(t)[t] end |
#topics ⇒ Object
40 41 42 |
# File 'lib/hermann/discovery/metadata.rb', line 40 def topics get_topics end |