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

Nifi:Writing new Processors

I want to make new processor which will be the reunion of GetFile and EvaluateXpath there are several subject i am interested in:

  1. How can i shrink my nar file now it is more than 20kb and my nifi can't run it?
  2. I want to get File from folder read it's data and put it as an atribute inside new flowfile,then rolling back config xml to it's original folder , how can i roll my config file back to folder b code?
  3. Here is simple code i use for getting attributes from xml config file :
  1. <code>XPathExpression start = xpath.compile("//*[local-name()='start']");
                    XPathExpression startDate = xpath.compile("//*[local-name()='startDate']");
                    XPathExpression endDate = xpath.compile("//*[local-name()='endDate']");
                    XPathExpression runAs = xpath.compile("//*[local-name()='run']");
                    
    Object resultStart = start.evaluate(doc, XPathConstants.STRING);
                    NodeList nodes = (NodeList) resultStart;
                    flowFile = session.putAttribute(flowFile, "start", String.valueOf(nodes.item(nodes.getLength()-1)));

    Map attributes = getAttributesFromFile(filePath); if (attributes.size() > 0) { flowFile = session.putAllAttributes(flowFile, attributes); }

but it does't work properly, what should i change?

here is my logs:

  1. and here is log result:org.apache.nifi.processor.exception.FlowFileHandlingException: StandardFlowFileRecord[uuid=2780cccb-99e9-4bae-8090-993f66222549,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1507094431111-1, container=default, section=1], offset=2120, length=212],offset=0,name=configs.xml,size=212] is not known in this session (StandardProcessSession[id=10])at org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3027)at org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3013)at org.apache.nifi.controller.repository.StandardProcessSession.remove(StandardProcessSession.java:1900)at Reader.MyProcessor.onTrigger(MyProcessor.java:537)at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748)
1 REPLY 1

Super Guru

please post more details, a log and more details.

connecting two processors is pretty standard, not sure you need to combine them.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.