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 2020/01/20 14:27:58 UTC

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #712: MINIFICPP-1047 Add property "Drop empty flow files" to PublishKafka

arpadboda commented on a change in pull request #712: MINIFICPP-1047 Add property "Drop empty flow files" to PublishKafka
URL: https://github.com/apache/nifi-minifi-cpp/pull/712#discussion_r368568039
 
 

 ##########
 File path: extensions/librdkafka/PublishKafka.cpp
 ##########
 @@ -639,6 +647,17 @@ void PublishKafka::onTrigger(const std::shared_ptr<core::ProcessContext> &contex
     PublishKafka::ReadCallback callback(max_flow_seg_size, kafkaKey, thisTopic->getTopic(), conn->getConnection(), flowFile,
                                         attributeNameRegex, messages, flow_file_index);
     session->read(flowFile, &callback);
+
+    bool dropEmptyFlowFiles;
+    if (!callback.called_ && context->getProperty(DropEmptyFlowFiles.getName(), dropEmptyFlowFiles) && !dropEmptyFlowFiles) {
+      // workaround: call callback since ProcessSession doesn't do so for empty flow files
+      logger_->log_debug("ReadCallback workaround on empty flow file, because DropEmptyFlowFiles is false, uuid: %s", flowFile->getUUIDStr());
+      callback.process(nullptr);
+    }
+    if (!callback.called_ && dropEmptyFlowFiles) {
+      logger_->log_info("Deprecated behavior, use connections to drop empty flow files! Dropped empty flow file with uuid: %s", flowFile->getUUIDStr());
 
 Review comment:
   I like this log message, but I would prefer moving this to connection to avoid duplicating to multiple processors. 
   Please also change the log level to debug (it's for developers, not operations) 

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