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

John Wang commented on KAFKA-291:
---------------------------------

examples (in java):

Producer:

instead of:

  Properties props = new Properties();
  props.put("zk.connect", "localhost:2181");
  props.put("serializer.class", "kafka.serializer.DefaultEncoder");

 ProducerConfig producerConfig = new ProducerConfig(props);
we can do:
   
  ProducerConfig producerConfig = new 
ProducerConfigBuilder().setZkConnect("localhost:2181").setSerializerClass("kafka.serializer.DefaultEncoder").build();


Consumer:

instead of:

Properties props = new Properties();
props.put("zk.connect", _zookeeperUrl);
props.put("consumer.timeout.ms", _kafkaSoTimeout);
props.put("groupid", _consumerGroupId);

ConsumerConfig consumerConfig = new ConsumerConfig(props);

we can do:

ConsumerConfig consumerConfig = new 
ConsumerConfigBuilder().setGroupId(_consumerGroupId).setZkConnect(_zookeeperUrl).setGroupId(_consumerGroupId).build();
                
> Add builder to create configs for consumer and broker
> -----------------------------------------------------
>
>                 Key: KAFKA-291
>                 URL: https://issues.apache.org/jira/browse/KAFKA-291
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.7
>            Reporter: John Wang
>         Attachments: builderPatch.diff
>
>
> Creating Consumer and Producer can be cumbersome because you have to remember 
> the exact string for the property to be set. And since these are just 
> strings, IDEs cannot really help.
> This patch contains builders that help with this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to