Member since
05-24-2017
4
Posts
0
Kudos Received
0
Solutions
06-06-2017
11:05 AM
Finally I made my own script. Something like that //WRITE AN ATTRIBUTE INTO A FILE
var flowFile = session.get();
var File = Java.type("java.io.RandomAccessFile");
if (flowFile != null) {
var filename = flowFile.getAttribute("filename");
var lang = flowFile.getAttribute("lang");
var text = flowFile.getAttribute("text");
/// write to file
var filePath = "/home/test/" + lang + "/inputData/" + filename;
flowFile = session.putAttribute(flowFile, "filePath", filePath);
var file = new File(filePath, "rw");
file.write(text.getBytes());
file.close();
// Finish by transferring the FlowFile to an output relationship
session.transfer(flowFile, REL_SUCCESS);
}
... View more
05-30-2017
08:01 AM
Thanks so much
... View more
05-24-2017
09:01 AM
As the title says, I want to write down into a file a nifi attribute, but maintaining the original flowfile. I have a external .jar that only accepts files, so I need to write an attribute into a file, and syncronhize the output with the corresponding flowfile. Thanks in advance.
... View more
Labels:
- Labels:
-
Apache NiFi