Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Nifi: how to write Custom processor

Highlighted

Nifi: how to write Custom processor

I want to write nifi processor which can read xml file from hdfs directory and then extracting it's data into flowfile attributes, also if there is case when two nifi processor can get this file and read data or write something into it how can i do file lock so that at a time only one processor can use it? Can you reccomend me any article, code examples or some related materials which can help me. i'haven't write any custom processor yet.

4 REPLIES 4
Highlighted

Re: Nifi: how to write Custom processor

Super Guru

I don't think you'd need a custom processor for this use case, you should be able to use ListHDFS -> FetchHDFS -> EvaluateXPath to read XML files from an HDFS location and then extract values as attributes. These processors, when configured correctly, will take care of the file handling and such, even across a NiFi cluster..

Highlighted

Re: Nifi: how to write Custom processor

Yes, but i want one processor to make all this job

Highlighted

Re: Nifi: how to write Custom processor

If i got code of this processor from github nifi code ListHDFS -> FetchHDFS -> EvaluateXPath->updateAttribute and reunite them in a way that they could work together can i make one perfectly working processor which can make all these tasks?

Re: Nifi: how to write Custom processor

Rising Star

Why do you need this functionality in a single processor?

If it is for reusability, I'd suggest you to create a process group and use it wherever you need it. If it is for locking and synchronization, I'd suggest to use something like Zookeeper to keep a status of the ongoing process (here you can find some processor to interact with Zookeeper).

Anyway, if you still need to write your custom processor, then please check this tutorial: https://community.hortonworks.com/articles/4318/build-custom-nifi-processor.html

Don't have an account?
Coming from Hortonworks? Activate your account here