<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Generate multiple FlowFiles with ExecuteScript in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Generate-multiple-FlowFiles-with-ExecuteScript/m-p/219870#M74649</link>
    <description>&lt;P&gt;Problem solved. &lt;BR /&gt;Found an entry from Matt Burgess which solved this very smart. &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; Thanks alot &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://community.hortonworks.com/questions/106878/split-one-nifi-flow-file-into-multiple-flow-file-b.html" target="_blank"&gt;https://community.hortonworks.com/questions/106878/split-one-nifi-flow-file-into-multiple-flow-file-b.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Feb 2018 17:27:10 GMT</pubDate>
    <dc:creator>checker_to</dc:creator>
    <dc:date>2018-02-16T17:27:10Z</dc:date>
    <item>
      <title>Generate multiple FlowFiles with ExecuteScript</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Generate-multiple-FlowFiles-with-ExecuteScript/m-p/219869#M74648</link>
      <description>&lt;P&gt;
	Hello, &lt;BR /&gt;
	&lt;BR /&gt;
	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. &lt;BR /&gt;
	Currently I'm tryining to send out each flowfile in a for-loop with this Statement&lt;/P&gt;&lt;PRE&gt;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


&lt;/PRE&gt;&lt;P&gt;When I run this code, some Flowfiles success, and other fails, with this Exception.&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;"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 &amp;lt;script&amp;gt; at line number 196: javax-script.ScriptException:"
&lt;/PRE&gt;&lt;P&gt;Seems that only one flowfile can be outputted for one input flowfile. &lt;BR /&gt;Is there another way to solve this? &lt;BR /&gt;&lt;BR /&gt;Splitting before ExecuteScript is not possible, because I do the Regex"Magic" inside the ExecuteScript with the Comment-Entry.&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;BR /&gt;Christian&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 16:50:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Generate-multiple-FlowFiles-with-ExecuteScript/m-p/219869#M74648</guid>
      <dc:creator>checker_to</dc:creator>
      <dc:date>2018-02-16T16:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Generate multiple FlowFiles with ExecuteScript</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Generate-multiple-FlowFiles-with-ExecuteScript/m-p/219870#M74649</link>
      <description>&lt;P&gt;Problem solved. &lt;BR /&gt;Found an entry from Matt Burgess which solved this very smart. &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; Thanks alot &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://community.hortonworks.com/questions/106878/split-one-nifi-flow-file-into-multiple-flow-file-b.html" target="_blank"&gt;https://community.hortonworks.com/questions/106878/split-one-nifi-flow-file-into-multiple-flow-file-b.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 17:27:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Generate-multiple-FlowFiles-with-ExecuteScript/m-p/219870#M74649</guid>
      <dc:creator>checker_to</dc:creator>
      <dc:date>2018-02-16T17:27:10Z</dc:date>
    </item>
  </channel>
</rss>

