metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From merrimanr <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #143: METRON-197: Validation should be the las...
Date Mon, 06 Jun 2016 18:16:36 GMT
Github user merrimanr commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/143#discussion_r65940558
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java
---
    @@ -143,14 +140,14 @@ public void execute(Tuple tuple) {
           boolean ackTuple = true;
           if(sensorParserConfig != null) {
             List<FieldValidator> fieldValidations = getConfigurations().getFieldValidations();
    -        List<JSONObject> messages = parser.parse(originalMessage);
    -        for (JSONObject message : messages) {
    -          if (parser.validate(message)) {
    +        Optional<List<JSONObject>> messages = parser.parseOptional(originalMessage);
    +        for (JSONObject message : messages.orElse(Collections.emptyList())) {
    +          if (parser.validate(message) && filter != null && filter.emitTuple(message))
{
                 if(!isGloballyValid(message, fieldValidations)) {
                   message.put(Constants.SENSOR_TYPE, getSensorType()+ ".invalid");
                   collector.emit(Constants.INVALID_STREAM, new Values(message));
                 }
    -            else if (filter != null && filter.emitTuple(message)) {
    +            else {
                   ackTuple = !isBulk;
    --- End diff --
    
    Shouldn't the tuple get acked regardless of whether it passed the validations or not?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message