title: Nifi:how to get only one flwoFile from success queue?
body: <p>I want  to   get  only  first   flowfile   which  was send in  sucess 'queue' from my  executescript  processor    but  i  can't  manage  it  here is  my  code:
  AND  THIS CODE  THROWS  EXCEPTION THAT FLOWFILE  HAS  ALREADY   MARKEDFOR TRANSFER</p>
  
  <ol>
  <li><p>how  can  i  remove  other  unused  flowfiles   and  how to  prevent getting  them  with  fist  flowfile(  i  mean when  i  delete  this  remove  command  exceptions  won't  be  present  but   process  will  take  every  flowfile  form sucess  queue  ,  how can i  prevent it?)</p>
  
  <pre><code>def List&lt;FlowFile&gt; flowFiles= session.get(1)
  def name="";
  def  count=" ";
  Double   value=0.0;
  def  numb=0;
  if(flowFiles.size()&gt;1){
  session.remove(flowFiles.remove(flowFiles.size()-1))
  
  }
  List&lt;FlowFile&gt; flowFiles2 = new ArrayList&lt;FlowFile&gt;();
  for(FlowFile  k in flowFiles){
  name=k.getAttribute("realName")
  count=k.getAttribute("count")
  value= count as Double;
  numb=Math.round(value)
  session.transfer(flowFiles.get(0),REL_SUCCESS)
  
  
  }   
  session.remove(flowFiles)
  </code></pre></li>
  </ol>