You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Lehel44 (via GitHub)" <gi...@apache.org> on 2023/03/01 15:09:58 UTC

[GitHub] [nifi] Lehel44 commented on a diff in pull request #6991: NIFI-11224 - FF attribute support in Where condition of QuerySalesforceObject

Lehel44 commented on code in PR #6991:
URL: https://github.com/apache/nifi/pull/6991#discussion_r1121887602


##########
nifi-nar-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/QuerySalesforceObject.java:
##########
@@ -326,24 +326,24 @@ protected Collection<ValidationResult> customValidate(ValidationContext validati
     public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
         boolean isCustomQuery = CUSTOM_QUERY.getValue().equals(context.getProperty(QUERY_TYPE).getValue());
 
+        FlowFile flowFile = session.get();

Review Comment:
   I recommend removing `flowfile == null` check before the condition. Based @markap14 answer in case of processors annotated with @TriggerSerially this check is not necessary. However if a processor can have multiple executing thread, the following can happen:
   
   "- 1 FlowFile in queue and 2 threads start running.
   -  Thread 1 calls session.get() and gets the only FlowFile.
   -  Then Thread 2 calls session.get() and gets back a null."
   
   The flowfile is optional and the null check will be handled in the `processQuery` and `processCustomQuery` methods.



##########
nifi-nar-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/QuerySalesforceObject.java:
##########
@@ -326,24 +326,24 @@ protected Collection<ValidationResult> customValidate(ValidationContext validati
     public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
         boolean isCustomQuery = CUSTOM_QUERY.getValue().equals(context.getProperty(QUERY_TYPE).getValue());
 
+        FlowFile flowFile = session.get();

Review Comment:
   I recommend removing flowfile == null check before the condition. Based @markap14 answer in case of processors annotated with @TriggerSerially this check is not necessary. However if a processor can have multiple executing thread, the following can happen:
   
   "- 1 FlowFile in queue and 2 threads start running.
   -  Thread 1 calls session.get() and gets the only FlowFile.
   -  Then Thread 2 calls session.get() and gets back a null."
   
   The flowfile is optional and the null check will be handled in the `processQuery` and `processCustomQuery` methods.



##########
nifi-nar-bundles/nifi-salesforce-bundle/nifi-salesforce-processors/src/main/java/org/apache/nifi/processors/salesforce/QuerySalesforceObject.java:
##########
@@ -326,24 +326,24 @@ protected Collection<ValidationResult> customValidate(ValidationContext validati
     public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
         boolean isCustomQuery = CUSTOM_QUERY.getValue().equals(context.getProperty(QUERY_TYPE).getValue());
 
+        FlowFile flowFile = session.get();

Review Comment:
   I recommend removing `flowfile == null` check before the condition. Based on @markap14 answer in case of processors annotated with @TriggerSerially this check is not necessary. However if a processor can have multiple executing thread, the following can happen:
   
   "- 1 FlowFile in queue and 2 threads start running.
   -  Thread 1 calls session.get() and gets the only FlowFile.
   -  Then Thread 2 calls session.get() and gets back a null."
   
   The flowfile is optional and the null check will be handled in the `processQuery` and `processCustomQuery` methods.



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

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org