markap14 commented on a change in pull request #3930: NIFI-6851: Added 
FlowFileAcquisitionMethod to fetch/receive methods i…
URL: https://github.com/apache/nifi/pull/3930#discussion_r357750687
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecord.java
 ##########
 @@ -278,6 +281,17 @@ public static StandardProvenanceEventRecord 
getEvent(final Record record, final
         }
         builder.setEventType(eventType);
 
+        // Determine acquisition method
+        final Integer flowFileAcquisitionOrdinal = (Integer) 
record.getFieldValue(EventFieldNames.FLOW_FILE_ACQUISITION_METHOD);
 
 Review comment:
   It is important, when serializing/deserializing enumerations that we not use 
the ordinal value. Consider that in a future version, we may add a new value to 
the enumeration, say FlowFIleAcquisitionMethod.FOO. If this is added in the 
first position of the enum, it would mean that all previously created 
Provenance Events are now corrupt/wrong, as they reference the wrong 
acquisition method.
   
   There are generally two approaches that we can take here. We can either 
write out the full name of the Provenance Event, or we can include in the 
header a mapping of Ordinal to Name, and then use that mapping here to 
determine what the Ordinal means. The former is simpler and generally provides 
code that is more clear. The latter generally results in (slightly) better 
performance because it has less to write/serialize and read/parse

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to