Github user ptgoetz commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/195#discussion_r15313891
  
    --- Diff: external/storm-kafka/src/test/storm/kafka/TestUtils.java ---
    @@ -34,4 +49,51 @@ public static GlobalPartitionInformation 
buildPartitionInfo(int numPartitions, i
             return globalPartitionInformation;
         }
     
    +    public static SimpleConsumer getKafkaConsumer(KafkaTestBroker broker) {
    +        BrokerHosts brokerHosts = getBrokerHosts(broker);
    +        KafkaConfig kafkaConfig = new KafkaConfig(brokerHosts, TOPIC);
    +        SimpleConsumer simpleConsumer = new SimpleConsumer("localhost", 
broker.getPort(), 60000, 1024, "testClient");
    +        return simpleConsumer;
    +    }
    +
    +    public static KafkaConfig getKafkaConfig(KafkaTestBroker broker) {
    +        BrokerHosts brokerHosts = getBrokerHosts(broker);
    +        KafkaConfig kafkaConfig = new KafkaConfig(brokerHosts, TOPIC);
    +        return kafkaConfig;
    +    }
    +
    +    private static BrokerHosts getBrokerHosts(KafkaTestBroker broker) {
    +        GlobalPartitionInformation globalPartitionInformation = new 
GlobalPartitionInformation();
    +        globalPartitionInformation.addPartition(0, 
Broker.fromString(broker.getBrokerConnectionString()));
    +        return new StaticHosts(globalPartitionInformation);
    +    }
    +
    +    public static Config getConfig(String brokerConnectionString) {
    +        Config config = new Config();
    +        Properties props = new Properties();
    +        props.put("metadata.broker.list", brokerConnectionString);
    +        props.put("request.required.acks", "1");
    +        props.put("serializer.class", "kafka.serializer.StringEncoder");
    --- End diff --
    
    Would it make sense to make the serializer class configurable? I can 
imagine cases where users would want to use other serialization schemes as they 
can with the spouts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to