<?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: Nifi:how  to  handle  trnasfer 'transaction' based on flowFile amount in nifi? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-how-to-handle-trnasfer-transaction-based-on-flowFile/m-p/228037#M70262</link>
    <description>&lt;P&gt;If you are waiting for X number of flow files to be received, you can use something like this (assuming you want 10 flow files):&lt;/P&gt;&lt;PRE&gt;def flowfileList = session.get(10)
if(flowfileList.size() &amp;lt; 10) {
  session.rollback()
  return
}
// If you get here, you have 10 flowfiles in flowfileList&lt;/PRE&gt;</description>
    <pubDate>Thu, 26 Oct 2017 02:10:18 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2017-10-26T02:10:18Z</dc:date>
    <item>
      <title>Nifi:how  to  handle  trnasfer 'transaction' based on flowFile amount in nifi?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-how-to-handle-trnasfer-transaction-based-on-flowFile/m-p/228036#M70261</link>
      <description>&lt;P&gt;I want to  make transfer  operation when  i   will  have certain amount  of  flowFile  in my  flowFile  queue, and  i make  remove  operation for unused File . Can remove operation   cause  to  dissapear  flowfile from  my  flowfile  array list ?  here is  my  code:&lt;/P&gt;&lt;PRE&gt;  import org.apache.commons.io.IOUtils
    import java.nio.charset.StandardCharsets
    import groovy.lang.*
    
    def flowFile=session.get();
    def name=flowFile.getAttribute("realName")
    def count=flowFile.getAttribute("count")
    def  filename=flowFile.getAttribute("filename")
    def value= count as Double;
    def numb=Math.round(value)
    def List&amp;lt;FlowFile&amp;gt; flowFiles= new ArrayList&amp;lt;&amp;gt;();
    flowFiles.add(flowFile)
    
    if(flowFiles.size()==numb){
    for(FlowFile i in flowFiles){
    if(i.getAttribute("filename").substring(0,10)==name){
    session.transfer(i,REL_SUCCESS);
    
    }
    }
    }
    
    else{
    
    session.remove(flowFile);
    
    }


&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 20:49:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-how-to-handle-trnasfer-transaction-based-on-flowFile/m-p/228036#M70261</guid>
      <dc:creator>salome_tkhilais</dc:creator>
      <dc:date>2017-10-25T20:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi:how  to  handle  trnasfer 'transaction' based on flowFile amount in nifi?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-how-to-handle-trnasfer-transaction-based-on-flowFile/m-p/228037#M70262</link>
      <description>&lt;P&gt;If you are waiting for X number of flow files to be received, you can use something like this (assuming you want 10 flow files):&lt;/P&gt;&lt;PRE&gt;def flowfileList = session.get(10)
if(flowfileList.size() &amp;lt; 10) {
  session.rollback()
  return
}
// If you get here, you have 10 flowfiles in flowfileList&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2017 02:10:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-how-to-handle-trnasfer-transaction-based-on-flowFile/m-p/228037#M70262</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-10-26T02:10:18Z</dc:date>
    </item>
  </channel>
</rss>

