<?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: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375779#M242651</link>
    <description>&lt;P&gt;there are no 2 success queues to PutFile, one is incoming to PutFile and the second outgoing to ExecuteScript and the third outgoing from ExecuteScript.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2023 08:39:43 GMT</pubDate>
    <dc:creator>MukaAddA</dc:creator>
    <dc:date>2023-08-30T08:39:43Z</dc:date>
    <item>
      <title>Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375652#M242570</link>
      <description>&lt;P&gt;when I am using PutFile Processor and ExecuteScript Processor,the object in the flow between them stuck for longer time than expected and processed many times.&lt;BR /&gt;this case happend only between these 2 processors only.&lt;BR /&gt;even if I set the expiration time for the flow and set it to 1 second, and scheduled the run of ExecuteScript to 4 sec, still processing the flow at least 2 times.&lt;BR /&gt;which cause sending the file to the API many times.&lt;BR /&gt;the version of the NIFI I am usnig is: NIFI v1.18, also I tried to upgrade and use version 1.22, but this issue still as is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script I am using in ExecuteScript is:&lt;/P&gt;&lt;P&gt;import org.apache.commons.io.IOUtils&lt;BR /&gt;import org.apache.nifi.processor.io.OutputStreamCallback&lt;/P&gt;&lt;P&gt;def flowFile = session.create()&lt;/P&gt;&lt;P&gt;def filePath = 'E:/tmp/tmp_file.txt'&lt;BR /&gt;def file = new File(filePath)&lt;/P&gt;&lt;P&gt;if (file.exists()) {&lt;BR /&gt;def fileContent = IOUtils.toByteArray(new FileInputStream(file))&lt;BR /&gt;&lt;BR /&gt;flowFile = session.write(flowFile, { outputStream -&amp;gt;&lt;BR /&gt;outputStream.write(fileContent)&lt;BR /&gt;} as OutputStreamCallback)&lt;BR /&gt;&lt;BR /&gt;session.transfer(flowFile, REL_SUCCESS)&lt;BR /&gt;} else {&lt;BR /&gt;session.remove(flowFile)&lt;BR /&gt;// Handle file not found or other error&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-08-28 11_07_11-NotificationsWindow.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38316i6D48B3CCEBBFADA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-08-28 11_07_11-NotificationsWindow.png" alt="2023-08-28 11_07_11-NotificationsWindow.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 08:20:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375652#M242570</guid>
      <dc:creator>MukaAddA</dc:creator>
      <dc:date>2023-08-28T08:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375722#M242618</link>
      <description>&lt;P&gt;Up&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 08:02:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375722#M242618</guid>
      <dc:creator>MukaAddA</dc:creator>
      <dc:date>2023-08-29T08:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375726#M242620</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105480"&gt;@MukaAddA&lt;/a&gt;, I see that you are linking two SUCCESS queues to your PutFile. Your PutFile will take all the items from both queues in a random order I assume. Try removing one of the success queues and see what happens. Besides that, see how you configured PutFile to handle the files with the same name, especially if you are using the name further in your processing.&lt;BR /&gt;&lt;BR /&gt;In addition, set you processor on Debug and see what it displays and maybe you get a hint from there regarding you problem.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 09:01:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375726#M242620</guid>
      <dc:creator>cotopaul</dc:creator>
      <dc:date>2023-08-29T09:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375779#M242651</link>
      <description>&lt;P&gt;there are no 2 success queues to PutFile, one is incoming to PutFile and the second outgoing to ExecuteScript and the third outgoing from ExecuteScript.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 08:39:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375779#M242651</guid>
      <dc:creator>MukaAddA</dc:creator>
      <dc:date>2023-08-30T08:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375803#M242661</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105480"&gt;@MukaAddA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Your issue is 100% in your script.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;The upstream queued FlowFile is being used as the trigger for execution of the ExecuteScript processor.&amp;nbsp; Instead of reading the upstream FlowFile in your script, you are creating a new FlowFile.&amp;nbsp; So I think what is happening here you have both the new FlowFile generated by your script along with the original FlowFile being passed to the downstream Success relationship.&lt;BR /&gt;&lt;BR /&gt;You may find the following article helpful:&lt;BR /&gt;&lt;A href="https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-2/ta-p/249018" target="_blank"&gt;https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-2/ta-p/249018&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;If you found that the provided solution(s) assisted you with your query, please take a moment to login and click&lt;/FONT&gt;&amp;nbsp;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;Accept as Solution&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="batang,apple gothic" color="#000000"&gt;below each response that helped.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="batang,apple gothic" color="#000000"&gt;Matt&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 16:03:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375803#M242661</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2023-08-30T16:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375823#M242674</link>
      <description>&lt;P&gt;Many thanks&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes this is my issue, but the problem I tried to change my above code based on below:&lt;/P&gt;&lt;P&gt;import org.apache.commons.io.IOUtils&lt;BR /&gt;import java.nio.charset.StandardCharsets&lt;BR /&gt;flowFile = session.get()&lt;BR /&gt;if(!flowFile)return&lt;BR /&gt;def text = ''&lt;BR /&gt;// Cast a closure with an inputStream parameter to InputStreamCallback&lt;BR /&gt;session.read(flowFile, {inputStream -&amp;gt;&lt;BR /&gt;text = IOUtils.toString(inputStream, StandardCharsets.UTF_8)&lt;BR /&gt;// Do something with text here&lt;BR /&gt;} as InputStreamCallback)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to make it reading the flow instead of creating new flow, but a lots of errors&lt;/P&gt;&lt;P&gt;any suggestions will be helpful for me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 09:56:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/375823#M242674</guid>
      <dc:creator>MukaAddA</dc:creator>
      <dc:date>2023-08-31T09:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/376075#M242756</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105480"&gt;@MukaAddA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sorry, writing such script is not a strong area for me.&amp;nbsp; I just happened to notice you were doing a session.create instead of a session.get.&amp;nbsp; You may get better help by raising a new question on how to create a script to be executed by the ExecuteScript processor to accomplish your use case and provide details on that use case.&amp;nbsp; I am sure there are others in the community that are good at writing such scripts.&lt;BR /&gt;&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 19:05:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Object-in-the-flow-stuck-between-PutFile-and-ExecuteScript/m-p/376075#M242756</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2023-09-06T19:05:19Z</dc:date>
    </item>
  </channel>
</rss>

