[ https://issues.apache.org/jira/browse/KAFKA-4436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15703682#comment-15703682 ]
Xavier Léauté commented on KAFKA-4436: -------------------------------------- [~gwenshap] One of the difference I see between configuring Kafka clients vs. configuring Kafka streams is the following: the client configuration mainly defines how my application interacts with Kafka brokers, whereas the streams configuration also defines the inherent behavior of the application I am writing. As such, the kafka streams configuration is less likely to reside in a configuration file outside of my application – as might be the case with the kafka clients – and more likely to be specified as part of the source code itself. That being said, I would also welcome builder patterns for Kafka client configuration, since that might provide a more user-friendly way of interacting programmatically with the clients. It may be worthwhile to keep the existing client configuration mechanism to allow easy configuration via property files, and then allow the builder pattern to work on top of it to override things programmatically. > Provide builder pattern for StreamsConfig > ----------------------------------------- > > Key: KAFKA-4436 > URL: https://issues.apache.org/jira/browse/KAFKA-4436 > Project: Kafka > Issue Type: Improvement > Components: streams > Reporter: Matthias J. Sax > Priority: Minor > > Currently, {{StreamsConfig}} parameters must be set "manually" as key value > pairs. This has multiple disadvantages from a user point of view: > - mandatory arguments could be missing > - data types might be wrong > - producer/consumer config parameters could conflict as they might have the > same name (user needs to know to prefix them to avoid conflict) > Those problems have different impact: either a runtime exception is thrown if > the problem is detected (e.g. missing parameter or wrong type) or the > application is just not configured correctly (producer/consumer has wrong > config). > A builder pattern would avoid those problems by forcing the user in the first > place to specify thing correctly (otherwise, it won't compile). For example > something like this: > {noformat} > StreamsConfig config = StreamsConfig.builder() > .setApplicationId(String appId) > .addBootstrapServer(String host, int port) > .addBootstrapServer(String host, int port) > .addZookeeper(String host, int port) > .addZookeeper(String host, int port) > .setStateDirectory(File path) > .setConsumerConfig( > ConsumerConfig.builder() > .setAutoOffsetReset(...) > .build() > ) > .build(); > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)