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

ASF GitHub Bot commented on METRON-694:
---------------------------------------

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

    https://github.com/apache/incubator-metron/pull/453#discussion_r100799069
  
    --- Diff: 
metron-platform/metron-writer/src/main/java/org/apache/metron/writer/bolt/BulkMessageWriterBolt.java
 ---
    @@ -74,7 +81,11 @@ public void prepare(Map stormConf, TopologyContext 
context, OutputCollector coll
         this.writerComponent = new BulkWriterComponent<>(collector);
         this.collector = collector;
         super.prepare(stormConf, context, collector);
    -    messageGetter = MessageGetters.valueOf(messageGetterStr);
    +    if 
(messageGetStrategyType.equals(MessageGetters.JSON_FROM_FIELD.name()) && 
messageGetField != null) {
    --- End diff --
    
    Why is this special case for JSON_FROM_FIELD required?  Is it because of 
the arg?  If so, it's probably better to adjust `MessageGetters` rather than 
doing it here.  I'd suggest making a factory rather than a strategy in this 
case for it:
    ```
    public enum MessageGetters {
    
      BYTES_FROM_POSITION(arg -> new BytesFromPosition(arg)),
      JSON_FROM_POSITION(arg -> new JSONFromPosition(arg)),
      JSON_FROM_FIELD(arg -> new JSONFromField(arg));
    
      Function<Object, MessageGetStrategy> messageGetStrategy;
    
      MessageGetters(Function<Object, MessageGetStrategy> messageGetStrategy) {
        this.messageGetStrategy = messageGetStrategy;
      }
    
      public MessageGetStrategy get(Object arg) {
        return messageGetStrategy.apply(arg);
      }
    }
    ```
    
    Then it becomes 
`MessageGetters.valueOf(messageGetStrategyType).get(messageGetField)`


> Index Errors from Topologies
> ----------------------------
>
>                 Key: METRON-694
>                 URL: https://issues.apache.org/jira/browse/METRON-694
>             Project: Metron
>          Issue Type: Bug
>            Reporter: Ryan Merriman
>
> Need to make sure (and review) that all the bolts write into the error queue. 
> Errors should then be consumed from the error queue and indexed.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to