You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/01 22:25:00 UTC

[jira] [Commented] (KAFKA-4436) Provide builder pattern for StreamsConfig

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

ASF GitHub Bot commented on KAFKA-4436:
---------------------------------------

wykapedia opened a new pull request #5722: [WIP] KAFKA-4436: Configurtion Builders
URL: https://github.com/apache/kafka/pull/5722
 
 
   - Added `ProducerConfigBuilder` to `ProducerConfig` to add easier dynamic creation of `ProducerConfig` properties `Map`.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> 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
>              Labels: needs-kip
>
> 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
(v7.6.3#76005)