public class BatchedConfigsFetcher extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BatchedConfigsFetcher.Builder
A builder class to make sure that BatchedConfigsFetcher is only created with params
that make sense.
|
Modifier and Type | Method and Description |
---|---|
Map<org.apache.kafka.common.config.ConfigResource,org.apache.kafka.clients.admin.Config> |
getConfigs()
Return configuration of the entities specified by
configResources list. |
static BatchedConfigsFetcher.Builder |
of(org.apache.kafka.clients.admin.Admin adminClient,
KafkaCruiseControlConfig config,
org.apache.kafka.common.config.ConfigResource.Type type,
org.apache.kafka.common.utils.Time time) |
public static BatchedConfigsFetcher.Builder of(org.apache.kafka.clients.admin.Admin adminClient, KafkaCruiseControlConfig config, org.apache.kafka.common.config.ConfigResource.Type type, org.apache.kafka.common.utils.Time time)
public Map<org.apache.kafka.common.config.ConfigResource,org.apache.kafka.clients.admin.Config> getConfigs()
configResources
list. This
method does following:
1. Batches config resources when sending request to Kafka. That allows Kafka response
to be manageable and limits Byte Buffer leak from plaintext listener.
2. Retries in case of a transient failure.
3. In case of failure allows clients to override error handling. This is done by specifying
a ConfigFetchErrorHandler
object. The class will call the error handler in
case of exception and will pass its return value to the OperationRetryer
,
which will take appropriate action based on it. Note that the error handler can
throw a RuntimeException that will get propagated from this class and caller can
then catch that. Tha allows clients to abort processing in case they understand
that the error is unrecoverable. For e.g. if something like UnknownTopicOrPartitionException
is thrown, there is no point in getting configuration of this topic.
4. If we need to get configuration for more than one config resource, then the method
can choose to ignore config for config resources that result in an error and return configs
for ones that succeed. This can either be done by setting ignoreUnknownTopicOrPartition
flag or by writing a custom error handler as described in previous item.