metron-dev mailing list archives

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

    https://github.com/apache/incubator-metron/pull/143#discussion_r66248395
  
    --- 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 --
    
    The tuple will be acked.  Note that ackTuple is initialized to true and is only set to
false if we are in a situation where we are doing a bulk write, in which case the tuple will
be acked in the bulk writer upon the writing of a batch of entries.  So, when this loop is
ended, it will ack on line 164.


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