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