import kafka.server.KafkaConfig
assert(KafkaConfig.LogCleanupPolicyProp == "log.cleanup.policy")
import java.util.Properties
val props = new Properties()
props.put(KafkaConfig.ZkConnectProp, ":9092") // required property
val kafkaConfig = KafkaConfig.fromProps(props, doLog = false)
import scala.collection.JavaConverters._
assert(kafkaConfig.logCleanupPolicy.asScala.head == "delete")
KafkaConfig
KafkaConfig is the configuration of a Kafka broker and the services.
KafkaConfig is created when:
-
DynamicBrokerConfigis requested to initialize and processReconfiguration
| Value | Kafka Property |
|---|---|
|
Used when:
|
|
Used exclusively for KafkaServer |
|
Used when |
|
Used exclusively when |
|
|
|
|
|
Used exclusively when |
|
|
|
Used when:
|
|
|
|
Used exclusively when |
|
|
|
Used when:
|
|
|
|
Used when:
|
|
Used when:
|
|
Used exclusively when |
|
Used exclusively when |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Used exclusively when |
|
|
|
|
|
|
|
Used for LogManager (for the kafka-log-retention task) |
|
Used exclusively when |
|
|
|
Used when:
|
|
Used exclusively when |
|
Used exclusively when |
|
|
|
Used exclusively when |
|
|
|
|
|
|
|
|
|
|
|
|
|
log.retention.ms, log.retention.minutes, or log.retention.hours (from the highest to the lowest priority) |
|
|
|
|
|
|
|
|
|
Used exclusively when |
|
Used exclusively when |
|
Used exclusively when |
|
Used exclusively when |
|
|
|
Used when |
|
|
|
|
|
Used when |
|
|
|
Used to create a ReplicaFetcherManager |
|
|
|
|
|
Used for |
|
Used for |
|
Used when:
|
|
|
|
Used when ReplicaFetcherBlockingSend is created (for the socketTimeout) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Used when |
|
|
|
Used exclusively when TransactionCoordinator is created |
|
Default: Topic-level property: unclean.leader.election.enable Used when:
|
|
Used exclusively when |
|
|
|
Used when:
|
|
|
|
|
|
authorizer Method
authorizer: Option[Authorizer]
authorizer takes the value of KafkaConfig.AuthorizerClassNameProp property.
If defined, authorizer creates an instance and returns it as an Authorizer (or a AuthorizerWrapper for the deprecated kafka.security.auth.Authorizer API). Otherwise, authorizer returns None.
authorizer throws a ConfigException for unsupported Authorizer API:
Authorizer does not implement org.apache.kafka.server.authorizer.Authorizer or kafka.security.auth.Authorizer .
|
Note
|
authorizer is used when KafkaServer is requested to start up.
|
listeners Method
listeners: Seq[EndPoint]
listeners creates the EndPoints based on listeners configuration property if defined. Otherwise, listeners assumes PLAINTEXT://[hostName]:[port] (per hostName and port).
listeners uses listenerSecurityProtocolMap for protocol mapping.
|
Note
|
|
advertisedListeners Method
advertisedListeners: Seq[EndPoint]
advertisedListeners…FIXME
|
Note
|
advertisedListeners is used when…FIXME
|
listenerSecurityProtocolMap Method
listenerSecurityProtocolMap: Map[ListenerName, SecurityProtocol]
listenerSecurityProtocolMap…FIXME
|
Note
|
listenerSecurityProtocolMap is used when…FIXME
|
getNumReplicaAlterLogDirsThreads Method
getNumReplicaAlterLogDirsThreads: Int
getNumReplicaAlterLogDirsThreads is num.replica.alter.log.dirs.threads if defined or the number of log directories.
|
Note
|
getNumReplicaAlterLogDirsThreads is used when ReplicaAlterLogDirsManager is created.
|
Creating KafkaConfig Instance
KafkaConfig takes the following to be created:
KafkaConfig initializes the internal properties.
Creating KafkaConfig From Java Properties — fromProps Object Method
fromProps(props: Properties): KafkaConfig (1)
fromProps(props: Properties, doLog: Boolean): KafkaConfig
fromProps(defaults: Properties, overrides: Properties): KafkaConfig (2)
fromProps(defaults: Properties, overrides: Properties, doLog: Boolean): KafkaConfig (3)
-
Seems to be used in tests only
-
Seems to be used in tests only
-
Seems to be used in tests only
fromProps…FIXME
|
Note
|
|
Creating KafkaConfig — apply Factory Method
apply(props: java.util.Map[_, _]): KafkaConfig
apply simply creates a KafkaConfig with the props and the doLog flag on.
|
Note
|
apply seems to be used in tests only.
|
Adding Reconfigurable to DynamicBrokerConfig — addReconfigurable Method
addReconfigurable(
reconfigurable: Reconfigurable): Unit
addReconfigurable simply requests the DynamicBrokerConfig to add the Reconfigurable.
|
Note
|
|
controlPlaneListener Method
controlPlaneListener: Option[EndPoint]
controlPlaneListener…FIXME
|
Note
|
controlPlaneListener is used when…FIXME
|
dataPlaneListeners Method
dataPlaneListeners: Seq[EndPoint]
dataPlaneListeners…FIXME
|
Note
|
dataPlaneListeners is used when…FIXME
|
validateValues Internal Method
validateValues(): Unit
validateValues…FIXME
|
Note
|
validateValues is used when KafkaConfig is created.
|
getInterBrokerListenerNameAndSecurityProtocol Internal Method
getInterBrokerListenerNameAndSecurityProtocol: (ListenerName, SecurityProtocol)
getInterBrokerListenerNameAndSecurityProtocol…FIXME
|
Note
|
getInterBrokerListenerNameAndSecurityProtocol is used when KafkaConfig is requested for interBrokerListenerName and interBrokerSecurityProtocol.
|
logRollTimeMillis Method
logRollTimeMillis: java.lang.Long
logRollTimeMillis is either the value of log.roll.ms or log.roll.hours (converted to millis).
|
Note
|
logRollTimeMillis is used when KafkaServer utility is used to copyKafkaConfigToLog (and set the topic-level segment.ms).
|
Security Protocol for Controller-Brokers Communication — controlPlaneSecurityProtocol Method
controlPlaneSecurityProtocol: Option[SecurityProtocol]
controlPlaneSecurityProtocol is the name of the security protocol based on control.plane.listener.name and listener.security.protocol.map configuration properties (via getControlPlaneListenerNameAndSecurityProtocol).
|
Note
|
controlPlaneSecurityProtocol is used when ControllerChannelManager is requested to add a new broker.
|
getControlPlaneListenerNameAndSecurityProtocol Internal Method
getControlPlaneListenerNameAndSecurityProtocol: Option[(ListenerName, SecurityProtocol)]
getControlPlaneListenerNameAndSecurityProtocol uses the control.plane.listener.name property for the listener name and looks it up in the listener.security.protocol.map for the security protocol.
getControlPlaneListenerNameAndSecurityProtocol returns None when the control.plane.listener.name property is not defined.
getControlPlaneListenerNameAndSecurityProtocol throws a ConfigException when the listener name could not be found:
Listener with [listenerName] defined in control.plane.listener.name not found in listener.security.protocol.map.
|
Note
|
getControlPlaneListenerNameAndSecurityProtocol is used when KafkaConfig is requested for the controlPlaneListenerName and controlPlaneSecurityProtocol.
|
Internal Properties
| Name | Description |
|---|---|
|
DynamicBrokerConfig (that could be provided or will be created from scratch) Used when:
|