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

    https://github.com/apache/metron/pull/1213#discussion_r223857423
  
    --- Diff: 
metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/ParserRunnerImpl.java
 ---
    @@ -101,26 +92,28 @@ public void init(Supplier<ParserConfigurations> 
parserConfigSupplier, Context st
       }
     
       @Override
    -  public void execute(String sensorType, RawMessage rawMessage, 
ParserConfigurations parserConfigurations) {
    -    if (onSuccess == null) {
    -      throw new IllegalStateException("An onSuccess function must be set 
before parsing a message.");
    -    }
    -    if (onError == null) {
    -      throw new IllegalStateException("An onError function must be set 
before parsing a message.");
    -    }
    +  public List<ParserResult> execute(String sensorType, RawMessage 
rawMessage, ParserConfigurations parserConfigurations) {
    +    List<ParserResult> parserResults;
         SensorParserConfig sensorParserConfig = 
parserConfigurations.getSensorParserConfig(sensorType);
         if (sensorParserConfig != null) {
           MessageParser<JSONObject> parser = 
sensorToParserComponentMap.get(sensorType).getMessageParser();
           List<JSONObject> messages = 
parser.parseOptional(rawMessage.getMessage()).orElse(Collections.emptyList());
    -      messages.forEach(message -> processMessage(sensorType, message, 
rawMessage, parser, parserConfigurations));
    +      parserResults = messages.stream()
    +              .map(message -> processMessage(sensorType, message, 
rawMessage, parser, parserConfigurations))
    +              .filter(Optional::isPresent)
    --- End diff --
    
    Remind me what the difference between not present, present, and present 
w/exception or error is wrt the return value from processMessage.


---

Reply via email to