You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/03/04 15:02:47 UTC

[GitHub] [nifi] mattyb149 commented on a change in pull request #3315: NIFI-5916 Added an option to enable empty flowfiles to be sent if the…

mattyb149 commented on a change in pull request #3315: NIFI-5916 Added an option to enable empty flowfiles to be sent if the…
URL: https://github.com/apache/nifi/pull/3315#discussion_r262095588
 
 

 ##########
 File path: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/GetMongo.java
 ##########
 @@ -228,12 +249,19 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
                     outgoingFlowFile = session.putAllAttributes(outgoingFlowFile, attributes);
                     session.getProvenanceReporter().receive(outgoingFlowFile, getURI(context));
                     session.transfer(outgoingFlowFile, REL_SUCCESS);
+                    sent++;
                 }
             }
 
             if (input != null) {
                 session.transfer(input, REL_ORIGINAL);
             }
+
+            if (sent == 0 && sendEmpty) {
+                FlowFile empty = session.create(input);
 
 Review comment:
   Still tracking down whether there's a bug or intended behavior, but if `input == null` here it causes an NPE (looks like its due to changes in #2974 ). Just to be safe it should probably check for null here and just call `create()` instead. Would make a good unit test too (to show it works without an incoming flow file).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services