Member since
08-11-2017
136
Posts
1
Kudos Received
0
Solutions
10-25-2017
01:49 PM
I want to make transfer operation when i will have certain amount of flowFile in my flowFile queue, and i make remove operation for unused File . Can remove operation cause to dissapear flowfile from my flowfile array list ? here is my code: import org.apache.commons.io.IOUtils
import java.nio.charset.StandardCharsets
import groovy.lang.*
def flowFile=session.get();
def name=flowFile.getAttribute("realName")
def count=flowFile.getAttribute("count")
def filename=flowFile.getAttribute("filename")
def value= count as Double;
def numb=Math.round(value)
def List<FlowFile> flowFiles= new ArrayList<>();
flowFiles.add(flowFile)
if(flowFiles.size()==numb){
for(FlowFile i in flowFiles){
if(i.getAttribute("filename").substring(0,10)==name){
session.transfer(i,REL_SUCCESS);
}
}
}
else{
session.remove(flowFile);
}
... View more
Labels:
- Labels:
-
Apache NiFi
10-25-2017
07:45 AM
As i have recognized each flowfile has it's different timestamp and if we send new flowfile in listHdfs processor it will have different timestamp from old ones so processor will send it to sucess "queue" , but what if there will be network or electricity problem and nifi will be timely turn off , in this case will listHdfs processor remember the last state?
... View more
Labels:
- Labels:
-
Apache NiFi
10-19-2017
01:47 PM
yes it was helpful thank you
... View more
10-18-2017
12:46 PM
I want to know if nifi 1.3.0 version contains groovy version in which i can use lambdas?.
... View more
Labels:
- Labels:
-
Apache NiFi
10-16-2017
06:37 PM
i have xml data like this below and i want to get localAttribtes tag by name 'rs' in my EvaluateXpath processor i tried this expression in my EvaluateXpath processor //localAttributes/*[@name='rs']/name() but i don't get "rs" tag value : <?xml version="1.0" encoding="UTF-8" standalone="no"?><service><localAttributes name="rs"><start>2017-09-07</start><startDate>2017-02-02</startDate><endDate>2017-03-02</endDate><runAs>true</runAs><patch>this is patch</patch><makeVersion>1</makeVersion></localAttributes><localAttributes name="ns"><start>2017-09-07</start><startDate>2017-02-02</startDate><endDate>2017-03-02</endDate><runAs>true</runAs><patch>this is patch</patch><makeVersion>1</makeVersion></localAttributes></service>
... View more
Labels:
- Labels:
-
Apache NiFi
10-11-2017
04:20 PM
I want to remove session in case i get certain data from file i have code like this,but i got errors "flowfile has already marked for removal", what should i change to get rid of extra errors? In case of session rollback flowfile will dissapear in queues also? 2.should i use rollback instead of remove()? NodeList childNodes = nodeGettingChanged.getChildNodes();for(int i =0; i != childNodes.getLength();++i){Node child = childNodes.item(i);if(!(child instanceofElement))continue;if(child.getNodeName().equals("runAs")){if(child.getFirstChild().getTextContent()=="false"){
session.remove(flowFile1);File deleteExtraFile =newFile("C://Users//s.tkhilaishvili//Desktop//try2//nifi-1.3.0//1//conf.xml");booleandelete=deleteExtraFile.delete();}else{
child.getFirstChild().setNodeValue("false");}}} Document finalXmlDocument = xmlDocument; session.write(flowFile1, new StreamCallback() { publicvoid process(InputStream inputStream,OutputStream outputStream)throwsIOException{TransformerFactory transformerFactory =TransformerFactory.newInstance();Transformer transformer =null;try{
transformer = transformerFactory.newTransformer();}catch(TransformerConfigurationException e){
e.printStackTrace();}DOMSource source =newDOMSource(finalXmlDocument);
ffStream.close();ByteArrayOutputStream bos =newByteArrayOutputStream();StreamResult result =newStreamResult(bos);try{
transformer.transform(source, result);}catch(TransformerException e){
e.printStackTrace();}byte[] array = bos.toByteArray();
outputStream.write(array);}});
session.remove(flowFile);
session.transfer(flowFile1, REL_SUCCESS);}
... View more
Labels:
- Labels:
-
Apache NiFi
10-08-2017
10:41 AM
Yes it was helpful 😄
... View more
10-06-2017
05:25 AM
I have set keep source file to false i have relative logic in my processors but when i get flowfile from folder i want to update it's data and then route it back to same folder but when i try to make this i mean putting i root folder it saves file i this forma '.filename.xml" how can i prevent doing this?
... View more
10-05-2017
07:03 AM
I have written custom processors like GetFile with some extra functionals but what i have mentioned is that it reitreives files for example conf.xml only once and then when i update it and roll back to folder with such name .conf.xml it doesn't reitreive this file how can i force processor to do it i mean , how can i force it reiterive any kind of file no matter how many times it was retrevied before. i use this code to roll back folder after updating file materials: final Path rootDirPath = Paths.get("C://Users//Desktop//try2//nifi-1.3.0//1");<br>final Path tempCopyFile = rootDirPath.resolve("."+flowFile.getAttribute(CoreAttributes.FILENAME.key()));<br>final Path dotCopyFile = tempCopyFile;
... View more
Labels:
- Labels:
-
Apache NiFi
09-28-2017
05:39 AM
I have to fetch online service with user Id-s(for example from 1 to 100) i have put 3 parameters start =1, end=100, parameter= 1, in GenerateFlowFile after that i wrote groovy code in exucutescript processor in a way that it generates 100 flowfile with certain user id-s i want to schedule my processor in a way that it can process only one flowfile in a day and reitreive only one user id in a day,i have workfloe like this GenerateFlowFile->ExecuteScript->InvokeHttp->putFile.I tried to change Back Pressure Object Threshold from 10000 to 1 but it doesn't work properly. What should i change to make this task?
... View more
Labels:
- Labels:
-
Apache NiFi