phrocker commented on a change in pull request #636: Minificpp-780 - Change
GenerateFlowFile to allow 0b content FlowFiles
URL: https://github.com/apache/nifi-minifi-cpp/pull/636#discussion_r320757682
##########
File path: extensions/standard-processors/processors/GenerateFlowFile.cpp
##########
@@ -77,7 +73,28 @@ void GenerateFlowFile::initialize() {
setSupportedRelationships(relationships);
}
+void generateData(std::vector<char>& data, bool textData = false) {
+ std::random_device rd;
+ std::mt19937 eng(rd());
+ if (textData) {
+ std::uniform_int_distribution<> distr(0, TEXT_LEN);
+ auto rand = std::bind(distr, eng);
+ std::generate_n(data.begin(), data.size(), rand);
+ std::for_each(data.begin(), data.end(), [](char & c) { c =
TEXT_CHARS[c];});
+ } else {
+ std::uniform_int_distribution<> distr(std::numeric_limits<char>::min(),
std::numeric_limits<char>::max());
+ auto rand = std::bind(distr, eng);
+ std::generate_n(data.begin(), data.size(), rand);
+ }
+}
+
void GenerateFlowFile::onTrigger(core::ProcessContext *context,
core::ProcessSession *session) {
+ std::unique_lock<std::mutex> lock(onTriggerMutex_, std::try_to_lock);
+ if (!lock.owns_lock()) {
+ logger_->log_warn("processor was triggered before previous listing
finished, configuration should be revised!");
Review comment:
This error message seems like it applies elsewhere since we are generating
data, not listing.
----------------------------------------------------------------
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