Over a million developers have joined DZone.

Properties File Lookup Augmentation of Data Flow in Apache NiFi 1.7.x

DZone's Guide to

Properties File Lookup Augmentation of Data Flow in Apache NiFi 1.7.x

In this article, a big data expert goes over reading from properties files to use with Apache NiFi flows. Read on to get started!

· Big Data Zone ·
Free Resource

Learn how to operationalize machine learning and data science projects to monetize your AI initiatives. Download the Gartner report now.

Properties File Lookup Augmentation of Data Flow in Apache NiFi 1.7.x

A really cool technologist contacted me on LinkedIn and asked an interesting question:


"How do I read values from a properties file and use them in my flow. I want to update/inject an attribute with this value.

"If you don't want to use the Variable Registry, but want to inject a value from a properties file how to do it. You could run some REST server and read it or does some file reading hack. But we have a great service to do this very easily!"

In my UpdateAttribute (or in your regular attributes already), I have an attribute named, keytofind. This contains a lookup key such as an integer or a string key. We will find that value in the properties value and give you that in an attribute of your choosing.

We have a Controller Service to handle this for you. It reads from your specified properties file. Make sure Apache NiFi has permissions to that path and can read the file.

We look up the key specified in the “keytofind.” It returns a value that you specify as an extra attribute, mine is “updatedvalue.”

This is my properties file:

-rwxrwxrwx  1 tspann  staff  67 Oct  4 09:15 lookup.properties

stuff3=value other

In this example, we are using the LookupAttribute processor. You can also use the LookupRecord processor depending on your needs.

Bias comes in a variety of forms, all of them potentially damaging to the efficacy of your ML algorithm. Our Chief Data Scientist discusses the source of most headlines about AI failures here.

apache nifi ,properties ,hadoop ,big data ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}