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

    https://github.com/apache/metron/pull/621#discussion_r126156447
  
    --- Diff: 
metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java
 ---
    @@ -176,16 +182,48 @@ public SimpleStormKafkaBuilder( Map<String, Object> 
kafkaProps
                                     , List<String> fieldsConfiguration
                                     )
       {
    +    this(kafkaProps, toSubscription(topic), zkQuorum, fieldsConfiguration);
    +  }
    +
    +  /**
    +   * Create an object with the specified properties and exposing the 
specified fields.
    +   * @param kafkaProps The special kafka properties
    +   * @param subscription The subscription to the kafka topic(s)
    +   * @param zkQuorum The zookeeper quorum.  We will use this to pull the 
brokers from this.
    +   * @param fieldsConfiguration The fields to expose in the storm tuple 
emitted.
    +   */
    +  public SimpleStormKafkaBuilder( Map<String, Object> kafkaProps
    +                                , Subscription subscription
    +                                , String zkQuorum
    +                                , List<String> fieldsConfiguration
    +                                )
    +  {
         super( getBootstrapServers(zkQuorum, kafkaProps)
              , 
createDeserializer(Optional.ofNullable((String)kafkaProps.get(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG)),
 DEFAULT_DESERIALIZER)
              , 
createDeserializer(Optional.ofNullable((String)kafkaProps.get(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG)),
 DEFAULT_DESERIALIZER)
    -         , topic
    +         , subscription
         );
         setProp(kafkaProps);
         setRecordTranslator(new 
SpoutRecordTranslator<>(FieldsConfiguration.toList(fieldsConfiguration)));
    -    this.topic = topic;
       }
     
    +
    +  private static Subscription toSubscription(String topicOrSubscription) {
    +    if (StringUtils.isEmpty(topicOrSubscription)) {
    +      throw new IllegalStateException("Topic name is invalid: empty or 
null");
    --- End diff --
    
    Could you make this IllegalArgumentException? It also might be nice to 
include the value itself, because empty vs null seem like they could come up in 
different ways.


---
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