Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

The value of NiFi variables is not getting populated in the field of controller service

avatar

I've created NiFi variables for broker uri, MQ Client Libraries path and MQ ConnectionFactory Implementation, and have set values for each variables(Variable names are broker_uri,client_libs,con_factory ). I could also see that my variables can detect the Referencing Controller service but variable's values are not getting populated in place of variable name, because of that status of controller service is invalid and after Hover to invalid icon it's showing me "broker uri can't be blank: ${boker_uri} " instead of variable values it's showing variable name like ${broker_uri}.

Thanks,

1 ACCEPTED SOLUTION

avatar
Super Mentor

@Rahoul A

Where have the key/value pairs for broker_uri,client_libs, and con_factory been defined?

Controller Services operate independent of processors and thus cannot rely on attributes defined on FlowFiles. The attribute values must be available to the controller service at all times.

The most typical place such attributes (key/value pairs) are in a nifi registry file.

# external properties files for variable registry
# supports a comma delimited list of file locations
nifi.variable.registry.properties=

set this property to point to a file you created that contains 1 to many key/value pairs.

Then create this file and make sure it is owned and accessible by the user that runs NiFi.

The content so f this file may look something like this:

broker_uri=tcp://localhost:4141
client_libs=/NiFi/custom-lib-dir/MQlib
con_factory=blah

Make sure there is only one entry per line and there are no leading or trailing whitespaces on each line. Then restart your NiFi.

The controller service should now appear valid as long as each value above is valid (i.e - defined lob path is valid and exists).

Attributes can also come from NiFi JVM properties defined in bootstrap.conf file and system environment variables defined for user running NiFi.

Thank you,

Matt

View solution in original post

5 REPLIES 5

avatar
Super Mentor

@Rahoul A

Where have the key/value pairs for broker_uri,client_libs, and con_factory been defined?

Controller Services operate independent of processors and thus cannot rely on attributes defined on FlowFiles. The attribute values must be available to the controller service at all times.

The most typical place such attributes (key/value pairs) are in a nifi registry file.

# external properties files for variable registry
# supports a comma delimited list of file locations
nifi.variable.registry.properties=

set this property to point to a file you created that contains 1 to many key/value pairs.

Then create this file and make sure it is owned and accessible by the user that runs NiFi.

The content so f this file may look something like this:

broker_uri=tcp://localhost:4141
client_libs=/NiFi/custom-lib-dir/MQlib
con_factory=blah

Make sure there is only one entry per line and there are no leading or trailing whitespaces on each line. Then restart your NiFi.

The controller service should now appear valid as long as each value above is valid (i.e - defined lob path is valid and exists).

Attributes can also come from NiFi JVM properties defined in bootstrap.conf file and system environment variables defined for user running NiFi.

Thank you,

Matt

avatar
Super Mentor

@Rahoul A

Forum tip: Try to avoid responding to existing "Answers" by creating a new "Answer". To keep threads easy to read, please use comments.

As far as using Process Group level defined variables, you are correct that it is not working as intended. I have created the following Jira to get this addressed:

https://issues.apache.org/jira/browse/NIFI-5073

The NiFi registry File does work however here.

Thank you,
Matt

If you found this answer addressed your question, please take a moment to click "accept" to close this thread.

avatar

@Matt Clarke Thanks for your response.

I am using NiFi 1.4 since there is an option to specify variables using UI.

I mean https://community.hortonworks.com/articles/154951/introduce-a-ui-driven-variable-registry-starting-f...

avatar

@Matt Clarke, Thanks for logging this as defect to the NiFi.

I've changed my answer to the comment.

avatar
Super Mentor

@Rahoul A

Progress of defects will not be tracked/updated in this forum. You can track the progress of this Jira through the Jira link provided above. Can you close this thread by clicking "accept" on an answer?

Thank you,

Matt