Support Questions
Find answers, ask questions, and share your expertise

How to use SimpleKeyValueLookupService processor in Nifi 1.3.0?

I am trying to create SimpleKeyValueLookupService. The usage document says:

"the coordinates that are passed to the lookup must contain the key 'key'."

What does that mean? Does it mean one of the properties created should have the name "key"? or can it have any name?

Can I dynamically add/change properties to this LookupService or is it static?

Thanks!

2 REPLIES 2

In SimpleKeyValueLookupService you can add as many user-defined properties as you want, lets say for example you added:

field1 = value1
field2 = value2
field3 = value3

Then you would use LookupRecord processor and add a user-defined property like:

key = field1

The LookupRecord processor is going to pass a Map with "key" -> "field1" to the SimpleKeyValueLookupService, the service is going to take the value of "key" which is "field1" and then lookup the value of that which is "value1".

When "value1" is returned to the processor it will be placed in each record in the location specified by "Result Record Path". So if your schema had a field called "lookupValue" and you set "Result Record Path" to "/lookupValue" then after passing through this processor, every record would have the field "lookupValue" set to "value1".

Thank you very much Bryan! Now, I am able to lookup the attribute and get the value for that key.

But, I am still confused on how the "Result RecordPath" works. This is how I have configured my Lookup Service:

20396-lookupattribute-config.jpg

But, when I am done with the lookup and check out DataProvenance, I do not see any field or attribute called "token". The value that is returned by the lookup now goes into a new attribute "key" (which now has a value "def". I was intending the value to go to "token" attribute. How do I do that?

20399-lookupattribute-dataprovenance.jpg

I have also attached my process flow XML (test-lookupattribute.xml).

Can you point me to any other documentation (if any) other than the Usage documents to figure out exactly how to use the LookupXXXXService processors?

Thanks!

VJ