public interface BrokerService
extends com.google.common.util.concurrent.Service
Modifier and Type | Interface and Description |
---|---|
static class |
BrokerService.BrokerChangeListener
Listener for changes in broker list.
|
Modifier and Type | Method and Description |
---|---|
Cancellable |
addChangeListener(BrokerService.BrokerChangeListener listener,
Executor executor)
Adds a listener to changes in broker list managed by this service.
|
String |
getBrokerList()
Returns a comma separate string of all current brokers.
|
Iterable<BrokerInfo> |
getBrokers()
Returns a live iterable that gives information for all the known brokers.
|
BrokerInfo |
getLeader(String topic,
int partition)
Returns the broker information of the current leader of the given topic and partition.
|
BrokerInfo getLeader(String topic, int partition)
topic
- Topic for looking up for leader.partition
- Partition for looking up for leader.BrokerInfo
containing information about the current leader, or null
if
current leader is unknown.Iterable<BrokerInfo> getBrokers()
Iterable
of BrokerInfo
that when Iterable.iterator()
is called, it returns
an iterator that gives the latest list of BrokerInfo
.String getBrokerList()
host1:port1,host2:port2
or empty string if no broker has been discovered.Cancellable addChangeListener(BrokerService.BrokerChangeListener listener, Executor executor)
listener
- The listener to invoke when there is changes.executor
- Executor to use for invocation to the listener.Cancellable
to stop listening.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.