kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Wang (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KAFKA-291) Add builder to create configs for consumer and broker
Date Sat, 03 Mar 2012 00:05:58 GMT

    [ 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):


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();


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


View raw message