<?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: how to add delay for 10 seconds while retrying a flow file in NIFI in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381046#M244215</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107711"&gt;@Rohit1997jio&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Need to understand your use case more....&lt;BR /&gt;&lt;BR /&gt;Agreed with&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;that the Wait and Notify processors are not what you want to use here.&lt;BR /&gt;&lt;BR /&gt;ControlRate processor may also not be your best option here.&amp;nbsp; assume you have multiple FlowFiles all route to failure.&amp;nbsp; All of those will reach that controlRate processor at about same time.&amp;nbsp; First goes right through if it has been 10 seconds since last Flowfile passed through it (so first is not delayed 10 seconds at all).&amp;nbsp; All FlowFiles queued behind allowing 1 to pass through every 10 seconds.&amp;nbsp; So with multiple FlowFiles you now have an even larger gap between processing.&lt;BR /&gt;&lt;BR /&gt;I see that you are using CFM 2.1.5 based off Apache NiFi 1.1.8.&amp;nbsp; In this version of NiFi the ability to handle retry on a relationship is built in to the processors framework.&amp;nbsp; This new feature is more powerful than the multiple processor method you are using now in the dataflow you shared above.&amp;nbsp; Your flow requires more processors and more resource usage. There is also no way to guarantee a exact 10 second delay.&amp;nbsp; So hope this is a soft requirement.&lt;BR /&gt;&lt;BR /&gt;Open the configuration for the PublishKafka processor and select the "Relationships" tab.&lt;BR /&gt;On the "failure" relationship you have the ability to check the box for "retry".&amp;nbsp; when selected, additional configuration parameters appear.&amp;nbsp; Here you can specify the number of retry attempts to make before the FlowFile is routed to the "failure" relationship.&amp;nbsp; You also have the ability to control how this processor behaves when retry is happening:&lt;BR /&gt;- Penalize (set/apply the penalty defined on the setting tab of processor to this FlowFile.&amp;nbsp; This FlowFile will not be retried until penaltly expires.&amp;nbsp; During this penalty duration processor will continue to process other FlowFiles.)&lt;BR /&gt;- Yield (Same as penalize EXCEPT, no other FlowFiles will get processed until this FlowFile is sucessfully processed or routed to failure relationship.&amp;nbsp; Useful when processing order of FlowFiles i important).&lt;BR /&gt;&lt;BR /&gt;What this built in retry will not do is apply same penalty to every retry.&lt;BR /&gt;Let's say you set "penalty duration" to 10 secs in setting tab.&amp;nbsp; Then you configure "number of retry attempts" to 3.&amp;nbsp; First failure results in FlowFile being penalized 10 secs, second attempt is penalized 20 secs, and third attempt is penalized 40 secs.&amp;nbsp; &amp;nbsp;This incremental back-off help reduce resource usage when you have continuous failure (something else you flow will not do).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Once all attempts to retry are exhausted without success, FlowFile would rout to failure where you could use LogMessage and send failed FlowFile to different processing path like you did in your dataflow.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Dec 2023 16:54:50 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2023-12-20T16:54:50Z</dc:date>
    <item>
      <title>how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381016#M244205</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;iam retrying a flow file 3 times before moving moving it to failure relationship&amp;nbsp; , with each retry i want to have 10 seconds gap in between them , so 2nd retry will happen after 10 seconds .&lt;/P&gt;&lt;P&gt;iam not able to understand how to use wait processor for this . What should be the configurations of that processor .&lt;/P&gt;&lt;P&gt;iam using older version of nifi so i can not use retryFlowFile processor .&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="retry.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39211iA49B9795319B8A86/image-size/large?v=v2&amp;amp;px=999" role="button" title="retry.png" alt="retry.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 20:54:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381016#M244205</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-12-19T20:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381020#M244207</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107711"&gt;@Rohit1997jio&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;What version are you using ? Have you looked into ControlRate processor ( &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.23.2/org.apache.nifi.processors.standard.ControlRate/index.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.23.2/org.apache.nifi.processors.standard.ControlRate/index.html&lt;/A&gt; )?&lt;/P&gt;&lt;P&gt;The wait processor is not supposed to be used by itself , it should be accompanied by the Notify processor and its used for certain scenarios where for example if you want to split data into multiple flowfiles and you want to wait for all of them to be processed before performing certain step and so on.&lt;/P&gt;&lt;P&gt;If that helps please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 21:15:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381020#M244207</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-12-19T21:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381036#M244211</link>
      <description>&lt;P&gt;control rate processor is nor working&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="reply1.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39223i169188744A6BD500/image-size/large?v=v2&amp;amp;px=999" role="button" title="reply1.png" alt="reply1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="reply2.png" style="width: 956px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39224i20D909C9A70D235A/image-size/large?v=v2&amp;amp;px=999" role="button" title="reply2.png" alt="reply2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 09:32:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381036#M244211</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-12-20T09:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381044#M244213</link>
      <description>&lt;P&gt;I noticed you are using the "data rate" for the Rate Control Criteria. I dont think this is the correct criteria , instead it should be by "flowfile count". Also you mentioned that you wanted to wait 10 seconds so the Time Duration property should be set as such.&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="SAMSAL_1-1703080960714.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39226i88757677EA8926D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_1-1703080960714.png" alt="SAMSAL_1-1703080960714.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Keep in mind setting the ControlRate this way means , that the processor will allow 1 flowfile to proceed to the success relationship every 10 secs, so if you have 3 files added to the queue around the same time , the first one will proceed after 10 seconds , 2ed will proceed after 20 secs and the 3rd in 30 secs.&amp;nbsp; If you are looking for only 10 secs on each file , you can use RouteOnAttribute as mentioned here: &lt;A href="https://stackoverflow.com/questions/61875809/introduce-time-delay-before-moving-flow-files-to-next-processor-in-nifi" target="_blank"&gt;https://stackoverflow.com/questions/61875809/introduce-time-delay-before-moving-flow-files-to-next-processor-in-nifi&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed also from your processors that you are using version 1.18 which should have retryflowfile .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that helps please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 14:40:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381044#M244213</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-12-20T14:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381046#M244215</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107711"&gt;@Rohit1997jio&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Need to understand your use case more....&lt;BR /&gt;&lt;BR /&gt;Agreed with&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;that the Wait and Notify processors are not what you want to use here.&lt;BR /&gt;&lt;BR /&gt;ControlRate processor may also not be your best option here.&amp;nbsp; assume you have multiple FlowFiles all route to failure.&amp;nbsp; All of those will reach that controlRate processor at about same time.&amp;nbsp; First goes right through if it has been 10 seconds since last Flowfile passed through it (so first is not delayed 10 seconds at all).&amp;nbsp; All FlowFiles queued behind allowing 1 to pass through every 10 seconds.&amp;nbsp; So with multiple FlowFiles you now have an even larger gap between processing.&lt;BR /&gt;&lt;BR /&gt;I see that you are using CFM 2.1.5 based off Apache NiFi 1.1.8.&amp;nbsp; In this version of NiFi the ability to handle retry on a relationship is built in to the processors framework.&amp;nbsp; This new feature is more powerful than the multiple processor method you are using now in the dataflow you shared above.&amp;nbsp; Your flow requires more processors and more resource usage. There is also no way to guarantee a exact 10 second delay.&amp;nbsp; So hope this is a soft requirement.&lt;BR /&gt;&lt;BR /&gt;Open the configuration for the PublishKafka processor and select the "Relationships" tab.&lt;BR /&gt;On the "failure" relationship you have the ability to check the box for "retry".&amp;nbsp; when selected, additional configuration parameters appear.&amp;nbsp; Here you can specify the number of retry attempts to make before the FlowFile is routed to the "failure" relationship.&amp;nbsp; You also have the ability to control how this processor behaves when retry is happening:&lt;BR /&gt;- Penalize (set/apply the penalty defined on the setting tab of processor to this FlowFile.&amp;nbsp; This FlowFile will not be retried until penaltly expires.&amp;nbsp; During this penalty duration processor will continue to process other FlowFiles.)&lt;BR /&gt;- Yield (Same as penalize EXCEPT, no other FlowFiles will get processed until this FlowFile is sucessfully processed or routed to failure relationship.&amp;nbsp; Useful when processing order of FlowFiles i important).&lt;BR /&gt;&lt;BR /&gt;What this built in retry will not do is apply same penalty to every retry.&lt;BR /&gt;Let's say you set "penalty duration" to 10 secs in setting tab.&amp;nbsp; Then you configure "number of retry attempts" to 3.&amp;nbsp; First failure results in FlowFile being penalized 10 secs, second attempt is penalized 20 secs, and third attempt is penalized 40 secs.&amp;nbsp; &amp;nbsp;This incremental back-off help reduce resource usage when you have continuous failure (something else you flow will not do).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Once all attempts to retry are exhausted without success, FlowFile would rout to failure where you could use LogMessage and send failed FlowFile to different processing path like you did in your dataflow.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:54:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381046#M244215</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2023-12-20T16:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381133#M244240</link>
      <description>&lt;P&gt;nifi version iam using is old&amp;nbsp;&lt;SPAN&gt;Powered by Apache NiFi - Version 1.8.0.3.3.0.0-165 , i have developed the same solution using retryFlowFile processor , but its working in my other environment due to old nifi version , so i need to have same implementation&amp;nbsp;in that too .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;even retry relation is not there in this version.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i was trying to achieve this by expression&amp;nbsp;language , but that is also not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 06:40:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381133#M244240</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-12-22T06:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381170#M244253</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107711"&gt;@Rohit1997jio&lt;/a&gt;&amp;nbsp; &amp;nbsp;Your images shared above are from CFM 2.1.5.&amp;nbsp; HDF 3.3.0 was released way back in 2017.&amp;nbsp; I strongly encourage you to upgrade away form such an old version for security and bug fixes reasons.&amp;nbsp;&lt;/P&gt;&lt;P&gt;That being said, you could use the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-scripting-nar/1.24.0/org.apache.nifi.processors.script.ExecuteScript/index.html" target="_self"&gt;ExecuteScript&lt;/A&gt; processor to manually penalize a FlowFile.&amp;nbsp; A penalized FlowFile will be ignored by the downstream processor until the penalty duration has lapsed.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;on the "setting" tab set the desired 10 sec "Penalty Duration" you want applied to every FlowFile the ExecuteScript processor executes against.&lt;/LI&gt;&lt;LI&gt;In the "properties" tab select "Groovy" as the "Script Engine" property value.&lt;/LI&gt;&lt;LI&gt;In the "properties" tab add the following script to the "Script Body" property:&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;FlowFile flowFile = session.get()
if (flowFile == null) {
  return;
}

session.transfer(session.penalize(flowFile), REL_SUCCESS)&lt;/LI-CODE&gt;&lt;P&gt;Use the ExecuteScript processor in place of your "ControlRate" processor in your dataflow to apply&amp;nbsp; the 10 second penalty to all FlowFiles being looped for retry.&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 17:21:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381170#M244253</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2023-12-22T17:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to add delay for 10 seconds while retrying a flow file in NIFI</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381173#M244254</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107711"&gt;@Rohit1997jio&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I was going to answer this similar to &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&amp;nbsp; who beat me to it but I will post my answer anyway in case it can help.&lt;BR /&gt;Basically &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp; is correct , you can use the ExecuteScript processor to somehow simulate the retry flowfile processor and its better than RouteOnAttribute Option because when you use penalize the processor is setting idle during this time unlike the RouteOnAttribute where its always looping to unmached relationship for the period of wait time. Anyway here is my solution and in my case you dont need RouteOnAttribute but you have to add more code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_6-1703261364929.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39265iC79EED911D2E62DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_6-1703261364929.png" alt="SAMSAL_6-1703261364929.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm using groovy code for my script. The process relies on two attributes:&lt;/P&gt;&lt;P&gt;1- &lt;STRONG&gt;totalRetry:&lt;/STRONG&gt; which incremental value to track the retry threshold every time the file is sent to retry. first time it will be set to 0.&lt;/P&gt;&lt;P&gt;2- &lt;STRONG&gt;isPenalized:&lt;/STRONG&gt; is used to track if the file should be penalized before each retry (isPenalized == null) or its already penalized which means its ready for the next retry.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_7-1703266423329.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39266i0F4822178FBDE3F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_7-1703266423329.png" alt="SAMSAL_7-1703266423329.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The groovy script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;flowFile = session.get()
if(!flowFile) return

// get totalPenalized and isPenalized attributes
totalRetry = flowFile.getAttribute('totalRetry')
isPenalized = flowFile.getAttribute('isPenalized')

// if its the first time set the value to 0 (no rety yet. first penalize) 
totalRetry = !totalRetry ? 0 : totalRetry.toInteger()

// if the total retry has passed the threshold ( 3 in this case) then send to failure rel (expired).
// Total wait time (penalize time) 3*10 sec = 30 secs

if(totalRetry.toInteger()&amp;gt;3)
{
	session.transfer(flowFile, REL_FAILURE)
	return
}

// if totalRetry has not passed the  threshold and the file is not 
// penalized (isPenalized == null) then penalize and send back to upstream queue
if(!isPenalized)
{
	flowFile = session.putAttribute(flowFile, 'isPenalized', '1')
	flowFile = session.penalize(flowFile)
	session.transfer(flowFile)
	return
	
}
// Otherwise file has been already penalized then send to retry and increment totalRetry
flowFile = session.putAttribute(flowFile, 'totalRetry', (totalRetry+1).toString())
flowFile = session.removeAttribute(flowFile, 'isPenalized')
session.transfer(flowFile, REL_SUCCESS)
return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can set the Penalize period under processor SETTINGS tab&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_8-1703266798552.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39267i4AA910217B03F45C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_8-1703266798552.png" alt="SAMSAL_8-1703266798552.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 17:52:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-add-delay-for-10-seconds-while-retrying-a-flow-file/m-p/381173#M244254</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-12-22T17:52:58Z</dc:date>
    </item>
  </channel>
</rss>

