How to create a Python Processor in Apache Nifi 2

While Apache Nifi is an amazing tool. It has introduced how to write processor in python directly and use it as is. If you follow the documentation, I hit a roadblock of how to make this imports work.

1from nifiapi.flowfiletransform import FlowFileTransform, FlowFileTransformResult

I am not a master python developer but can code and i was using all sort of pip install which never resolved to these import. And then eventually discovered that under following file these files are present

1$NIFI_HOME/python/api

tree command output as below:

png

For PyCharm

I had to add this $NIFI_HOME/python/api as the content root which eventually looked liked this

png

Processor Running

png

Download

You can Download Processor Definition from here python-sample-processor.json

comments powered by Disqus