title: Transfer multiple flowFiles from ExecuteScript in Nifi
body: <p>I am trying to generate multiple flowfiles from one flowfile using an ExecuteScript processor in python.</p>
  
  <p>The ouputs flowfiles depend on one attribute for configuration and the input flowfile (xml content).</p>
  
  <p>I tried many things but I always ends with error like :</p>
  
  <ul>
  <li>this flowfile is already marked for transfer</li>
  <li>transfer relationship not specified</li>
  </ul>
  
  <p>Below the last version :</p>
  
  <pre><code>from org.apache.commons.io import IOUtils
  from java.nio.charset import StandardCharsets
  from org.apache.nifi.processor.io import StreamCallback
  import java.io
  from org.python.core.util import StringUtil
  
  class PyStreamCallback(StreamCallback):
      def __init__(self, flowFile):
          global matched
          self.parentFlowFile = flowFile
          pass
  
      def process(self, inputStream, outputStream):
          try:
              text_content = IOUtils.toString(inputStream, StandardCharsets.UTF_8)
              flowfiles_list = []
  
              new_xml = "blabla"
              outputStream.write(bytearray(new_xml.encode('utf-8')))
  
              for n in range(0,5):
                  flowFile = session.create(self.parentFlowFile)
                  if (flowFile != None):
                      flowFile = session.write(flowFile, "Nothing")
                      flowfiles_list.append(flowFile)
  
              for flow in flowfiles_list:
                  session.transfer(flow, REL_SUCCESS)
          except:
              print('Error inside process')
              raise
  
  originalFlowFile = session.get()
  if(originalFlowFile != None):
      try :
          originalFlowFile = session.write(originalFlowFile, PyStreamCallback(originalFlowFile))
          session.remove(originalFlowFile)
  
      except Exception as e:
          originalFlowFile = session.putAttribute(originalFlowFile,'python_error', str(e))
          session.transfer(originalFlowFile, REL_FAILURE)
  </code></pre>
  
  <p>Can someone tell me what I am doing wrong and how to achieve what I want to do?</p>