Hi folks,

I'm trying to adapt the flow described at
https://community.hortonworks.com/articles/138632/data-flow-enrichment-with-nifi-lookuprecord-proces.html
using ScriptedLookupService as replacement for SimpleKeyValueLookupService
to lookup city names and enrich and incoming record.

When I ran the flow with KeyValueLookupService the field gets enriched
properly but when I use my scriptedlookup the value always come back as
null.  The script was pretty simple and I can't figure out where is my
error. I also tried the ScriptLookup (just the script, not the flow) by
AloPresto at
https://gist.github.com/alopresto/78eb1a2c2b878f75f61481269af38a9f with the
same resutls.

I'm trying to log.info the execution to figure out my mistakes but the logs
are going nowhere. How can I enable logging for services?

Does anyone spot an error?

---[service-lookup.groovy]---
import org.apache.nifi.lookup.StringLookupService

class GroovyLookupService implements StringLookupService {

  def lookupTable = [
    '1': 'Paris',
    '2': 'Lyon',
    '3': 'Marseille',
    '4': 'Toulouse',
    '5': 'Nice'
  ]

    @Override
    Optional<String> lookup(final String key) {
      log.warn('key value: ', key)
      return Optional.ofNullable(lookupTable[key])
    }
}

lookupService = new GroovyLookupService()
---

Reply via email to