mirror of https://github.com/reiseburo/hermann
Update the Hermann::Discovery::Zookeeper API to return an Array of brokers more suitable for Hermann::Producer
This commit is contained in:
parent
8400cfdc15
commit
3c9c234c43
|
@ -24,8 +24,7 @@ module Hermann
|
|||
# tickTime (as set in the server configuration) and a maximum
|
||||
# of 20 times the tickTime2 times the tick time set on server"
|
||||
#
|
||||
# @return [String] comma separated list of brokers
|
||||
#
|
||||
# @return [Array] List of brokers from ZK
|
||||
# @raises [NoBrokersError] if could not discover brokers thru zookeeper
|
||||
def get_brokers(timeout=0)
|
||||
brokers = []
|
||||
|
@ -35,7 +34,7 @@ module Hermann
|
|||
if brokers.empty?
|
||||
raise Hermann::Errors::NoBrokersError
|
||||
end
|
||||
brokers.join(',')
|
||||
return brokers
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -82,4 +81,4 @@ module Hermann
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ describe Hermann::Discovery::Zookeeper do
|
|||
context 'with valid brokers' do
|
||||
let(:brokers) { broker_array }
|
||||
it 'gets valid string' do
|
||||
expect(subject.get_brokers).to eq 'f:1,a:2'
|
||||
expect(subject.get_brokers).to eq broker_array
|
||||
end
|
||||
end
|
||||
context 'with no brokers' do
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
kafka:
|
||||
brokers: "localhost:12345"
|
||||
brokers:
|
||||
- "localhost:12345"
|
||||
topic: "testing-topic"
|
||||
zookeepers: "localhost:2181"
|
||||
zookeepers: "localhost:2181"
|
||||
|
|
Loading…
Reference in New Issue