DBZ-4045 Use listener props for deprecated host & port props
This commit is contained in:
parent
61016ef01b
commit
2eae7a742c
@ -102,7 +102,7 @@ protected void populateDefaultConfiguration(Properties props) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a configuration property. Several key properties that deal with Zookeeper, the host name, and the broker ID,
|
||||
* Set a configuration property. Several key properties that deal with Zookeeper, and the broker ID,
|
||||
* may not be set via this method and are ignored since they are controlled elsewhere in this instance.
|
||||
*
|
||||
* @param name the property name; may not be null
|
||||
@ -115,8 +115,7 @@ public KafkaServer setProperty(String name, String value) {
|
||||
throw new IllegalStateException("Unable to change the properties when already running");
|
||||
}
|
||||
if (!KafkaConfig.ZkConnectProp().equalsIgnoreCase(name)
|
||||
&& !KafkaConfig.BrokerIdProp().equalsIgnoreCase(name)
|
||||
&& !KafkaConfig.HostNameProp().equalsIgnoreCase(name)) {
|
||||
&& !KafkaConfig.BrokerIdProp().equalsIgnoreCase(name)) {
|
||||
this.config.setProperty(name, value);
|
||||
}
|
||||
return this;
|
||||
@ -162,7 +161,6 @@ public Properties config() {
|
||||
runningConfig.putAll(config);
|
||||
runningConfig.setProperty(KafkaConfig.ZkConnectProp(), zookeeperConnection());
|
||||
runningConfig.setProperty(KafkaConfig.BrokerIdProp(), Integer.toString(brokerId));
|
||||
runningConfig.setProperty(KafkaConfig.HostNameProp(), "localhost");
|
||||
runningConfig.setProperty(KafkaConfig.AutoCreateTopicsEnableProp(), String.valueOf(config.getOrDefault(KafkaConfig.AutoCreateTopicsEnableProp(), Boolean.TRUE)));
|
||||
// 1 partition for the __consumer_offsets_ topic should be enough
|
||||
runningConfig.setProperty(KafkaConfig.OffsetsTopicPartitionsProp(), Integer.toString(1));
|
||||
@ -209,7 +207,7 @@ public synchronized KafkaServer startup() {
|
||||
|
||||
// Determine the port and adjust the configuration ...
|
||||
port = desiredPort > 0 ? desiredPort : IoUtil.getAvailablePort();
|
||||
config.setProperty(KafkaConfig.PortProp(), Integer.toString(port));
|
||||
config.setProperty(KafkaConfig.ListenersProp(), "PLAINTEXT://localhost:" + port);
|
||||
// config.setProperty("metadata.broker.list", getConnection());
|
||||
|
||||
// Start the server ...
|
||||
|
Loading…
Reference in New Issue
Block a user