[
https://issues.apache.org/jira/browse/MINIFI-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15848419#comment-15848419
]
ASF GitHub Bot commented on MINIFI-171:
---------------------------------------
Github user phrocker commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/37#discussion_r98902595
--- Diff: libminifi/src/Processor.cpp ---
@@ -206,6 +207,29 @@ bool Processor::getProperty(std::string name,
std::string &value)
}
}
+bool Processor::getDynamicProperty(std::string name, std::string &value)
+{
+ if (isRunning())
+ // Because set property only allowed in non running state, we
need to obtain lock avoid rack condition
+ _mtx.lock();
+
+ std::map<std::string, Property>::iterator it =
_dynamicProperties.find(name);
+ if (it != _dynamicProperties.end())
+ {
+ Property item = it->second;
+ value = item.getValue();
+ if (!isRunning())
+ _mtx.unlock();
+ return true;
+ }
+ else
+ {
+ if (!isRunning())
--- End diff --
I'm new to this, so forgive the question, but why only unlock when it is
not running if the above conditional works only when it is running? This would
imply the mutex is locked when you are running. I likely missed something,
though.
> Dynamic Properties support for processors
> -----------------------------------------
>
> Key: MINIFI-171
> URL: https://issues.apache.org/jira/browse/MINIFI-171
> Project: Apache NiFi MiNiFi
> Issue Type: Improvement
> Components: C++
> Affects Versions: cpp-0.1.0
> Reporter: Jeremy Dyer
> Assignee: Jeremy Dyer
> Fix For: cpp-0.2.0
>
>
> Currently any Property read from the config.yml file that is not explicitly
> defined in the processor's implementation will be ignored by Processor.cpp
> when reading the configurations. This prevents any dynamic property from
> being defined in the config.yml and passed to the processor at runtime.
> Certain processors rely heavily on the concept of dynamic properties that are
> passed to them at runtime to handle things like setting dynamic properties
> based on properties that are declared. All of these possibilities cannot be
> handled upfront so there should be a mechanism, most likely in Processor.cpp,
> that allows for a list of dynamicProperties that are parsed form the
> config.yml file to be stored and accessed by the underlying processor
> implementation at runtime and use them as the processor desires.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)