nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy LoPresto <alopre...@apache.org>
Subject Re: Getting the value of a variable defined in a processor group
Date Tue, 14 May 2019 18:05:41 GMT
Vijay, 

I don’t believe there is a good way to get a complete list of all variables within processor
code. If you want to explore this further, you can take a look at StandardProcessContext [1],
which processors have access to in their #onTrigger() method, and MutableVariableRegistry
[2], which is the only concrete implementation of the ComponentVariableRegistry interface
which exposes a variable map (the StandardComponentVariableRegistry returns an empty map when
accessed). The issue is that the context does not expose the ProcessorNode field, which is
the intermediary to the variable registry. I believe this is by design. There may be a valid
use case to provide an accessor method on the context to return a variable map, or at least
the entry set. 

I’d like to hear from Matt Gilman, Bryan Bende, and/or Mark Payne with their thoughts, since
much of this code was written by them. 

[1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardProcessContext.java#L87
[2] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/variable/MutableVariableRegistry.java#L27
<https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/variable/MutableVariableRegistry.java#L27>


Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On May 14, 2019, at 10:48 AM, Vijay Chhipa <vchhipa@apple.com> wrote:
> 
> Hello
> 
> I am writing a new NiFi processor. In the source code I would like to use a variable
defined in the NiFi processor group using the UI. 
> Is there a way to get the map of all the variables available to this processor?
> 
> 
> I am on NiFi 1.9.1 
> 
> 
> Thanks
> 
> 
> 


Mime
View raw message