Oleg Muravskiy created KAFKA-9170:
-------------------------------------
Summary: KafkaStreams constructor fails to read configuration from
Properties object created with default values
Key: KAFKA-9170
URL: https://issues.apache.org/jira/browse/KAFKA-9170
Project: Kafka
Issue Type: Bug
Components: streams
Affects Versions: 2.3.0
Reporter: Oleg Muravskiy
When the *Properties* object passed in to the *KafkaStreams* constructor is
created like
{code:java}
new Properties(defaultProperties){code}
KafkaStreams fails to read properties properly, which in my case results in an
error:
{noformat}
org.apache.kafka.common.config.ConfigException: Missing required configuration
"bootstrap.servers" which has no default
value.org.apache.kafka.common.config.ConfigException: Missing required
configuration "bootstrap.servers" which has no default value. at
org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:476) at
org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:466) at
org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:108)
at
org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:142)
at org.apache.kafka.streams.StreamsConfig.<init>(StreamsConfig.java:844) at
org.apache.kafka.streams.StreamsConfig.<init>(StreamsConfig.java:839) at
org.apache.kafka.streams.KafkaStreams.<init>(KafkaStreams.java:544)
{noformat}
This is due to the fact that the constructor that receives the *Properties*
class:
{code:java}
public KafkaStreams(final Topology topology,
final Properties props) {
this(topology.internalTopologyBuilder, new StreamsConfig(props), new
DefaultKafkaClientSupplier());
{code}
passes *props* into *StreamsConfig*, which ignores the *Properties* interface,
and only uses the *Map* interface:
{code:java}
public StreamsConfig(final Map<?, ?> props) {
this(props, true);
}
{code}
(Note that if you do
{{props.getProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG)}}, it returns the
correct value).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)