[ 
https://issues.apache.org/jira/browse/KAFKA-9170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16972187#comment-16972187
 ] 

Oleg Muravskiy commented on KAFKA-9170:
---------------------------------------

Hi [~guozhang],

And this is exactly the problem.

if this "by-design" declares its input type as *Properties*, it must support 
any object of this type, no matter how it was constructed.

If does not support *Properties*, but only *Map*, then it should declare the 
input type as a *Map*.

 

 

> 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
>            Priority: Major
>
> 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)

Reply via email to