fgerlits commented on a change in pull request #1257:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1257#discussion_r802686280
##########
File path: extensions/standard-processors/processors/TailFile.cpp
##########
@@ -846,7 +874,28 @@ void TailFile::checkForNewFiles() {
return true;
};
- utils::file::list_dir(base_dir_, add_new_files_callback, logger_,
recursive_lookup_);
+ if (attribute_provider_service_) {
+ for (const auto& base_dir : getBaseDirectories(context)) {
+ utils::file::list_dir(base_dir, add_new_files_callback, logger_,
recursive_lookup_);
+ }
+ } else {
+ utils::file::list_dir(base_dir_, add_new_files_callback, logger_,
recursive_lookup_);
+ }
+}
+
+std::vector<std::string> TailFile::getBaseDirectories(core::ProcessContext&
context) const {
+ gsl_Expects(attribute_provider_service_);
+
+ const auto attribute_maps = attribute_provider_service_->getAttributes();
+ return attribute_maps |
+ ranges::views::transform([&context](const auto& attribute_map) {
+ auto flow_file = std::make_shared<FlowFileRecord>();
+ for (const auto& [key, value] : attribute_map) {
+ flow_file->setAttribute(key, value);
+ }
+ return context.getProperty(BaseDirectory, flow_file).value();
Review comment:
This function is only used (and really only makes sense) in `Multiple
file` mode, when `BaseDirectory` is a required property: `onSchedule()` will
throw if it is not set.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]