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( org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState( org.apache.nifi.controller.repository.StandardProcessSession.remove( Reader.MyProcessor.onTrigger( org.apache.nifi.processor.AbstractProcessor.onTrigger( org.apache.nifi.controller.StandardProcessorNode.onTrigger( org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$ java.util.concurrent.Executors$ java.util.concurrent.FutureTask.runAndReset( java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301( java.util.concurrent.ScheduledThreadPoolExecutor$ java.util.concurrent.ThreadPoolExecutor.runWorker( java.util.concurrent.ThreadPoolExecutor$

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.