Hello,
I'm trying to generate multiple FlowFIles out of one input (using ExecuteScript with Jython), because I need to split a "Comment"-Entry into multiple information.
Currently I'm tryining to send out each flowfile in a for-loop with this Statement
for i in iterTyreFinder:
....SomeMagic
flowFile2 = session.write(flowFile, PyOutputStreamCallback())
session.transfer(flowFile2, REL_SUCCESS)
Where the OutputStreamCallback only writes the text of an variable out
# Define a subclass of OutputStreamCallback for use in session.write()
class PyOutputStreamCallback(OutputStreamCallback):
def __init__(self):
pass
def process(self, outputStream):
outputStream.write(bytearray(ioV.outputText.encode('utf-8')))
# end class
When I run this code, some Flowfiles success, and other fails, with this Exception.
"Failed to process session due to org.apache.nifi.processor.execption.ProcessException: javax.script.ScriptException: org.apache.nifi.process.execption.FlowFIleHandlingException:
.....
.....
is already marked for transfer in <script> at line number 196: javax-script.ScriptException:"
Seems that only one flowfile can be outputted for one input flowfile.
Is there another way to solve this?
Splitting before ExecuteScript is not possible, because I do the Regex"Magic" inside the ExecuteScript with the Comment-Entry.
Thanks for any help.
Christian