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

Sam Meder commented on KAFKA-943:
---------------------------------

I would actually argue that it is easier on external "code" users of Kafka to 
have the string constants be named/indirected. And at least in our case we use 
these constants much more in code than in config files (all consumer/producer 
props are in code, server props are mostly in config files except for test 
related stuff) and having named strings allows typed languages to correctly 
detect changes (renames and deletes) and allows for much better IDE support. I 
think that outweighs the benefit of having a higher barrier of entry to making 
changes on the Kafka side, especially since the pain of changing will be felt 
"more" by everyone, but we're down to opinions now.

Anyway, an alternative to achieving some of the same goals would be to change 
validation in the configuration classes so it only accepts properties it knows 
about (unrecognized properties would cause errors). That might obviously cause 
people who put all configuration properties for their application (including 
the Kafka ones) a bit of pain, but would allow folks to detect changed and 
removed properties. Note the even the Kafka codebase itself was still 
referencing properties that no longer exist (fixed in the patch) and this is a 
real problem in our experience in tracking 0.8.
                
> Move all configuration key string to constants
> ----------------------------------------------
>
>                 Key: KAFKA-943
>                 URL: https://issues.apache.org/jira/browse/KAFKA-943
>             Project: Kafka
>          Issue Type: Improvement
>          Components: config
>    Affects Versions: 0.8
>            Reporter: Sam Meder
>         Attachments: configConstants.patch
>
>
> The current code base has configuration key strings duplicated all over the 
> place. They show up in the actual *Config classes, a lot of tests, command 
> line utilities and other examples. This makes changes hard and error prone. 
> DRY...
> The attached patch moves these configuration keys to constants and replaces 
> their usage with a reference to the constant. It also cleans up a few old 
> properties and a few misconfigured tests. I've admittedly not written a whole 
> lot of Scala, so there may be some improvements that can be made, in 
> particular I am not sure I chose the best strategy for keys needed by the 
> SyncProducerConfigShared trait (or traits in general).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to