<?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 handling failures in failure realtionship based on message in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/nifi-handling-failures-in-failure-realtionship-based-on/m-p/197895#M71389</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/20255/dheeruksingh.html" nodeid="20255" target="_blank"&gt;@dhieru singh&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Failure relation messages &lt;STRONG&gt;won't have any write attribute(failure attribute)&lt;/STRONG&gt; that is added to the flow files when the &lt;STRONG&gt;ff are transferred to failure queue&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;But you can use either of &lt;STRONG&gt;below methods&lt;/STRONG&gt; to check the &lt;STRONG&gt;length or size&lt;/STRONG&gt; of the flow files and &lt;STRONG&gt;route to SplitText processors&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;1.Checking size of the flow file and routing to split text processor.&lt;/P&gt;&lt;P&gt;2.Check the length of the message and route to split text processor&lt;/P&gt;&lt;P&gt;3.Using Route On Content processor&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1.Checking size of the flow file and routing to split text processor:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;If you know the size of the flow file that will be having Message is too long then you can use Route on Attribute processor and add new property&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;size more than 1 byte &lt;/STRONG&gt;as&lt;/P&gt;&lt;PRE&gt;${fileSize:gt(1)} //Here we are checking the flow file size is greater than 1 byte&lt;/PRE&gt;&lt;P&gt;So like this way you can filter out the flow files based on the size of the flow file but first you need to know the size of the flow files which are routing to failure.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42633-routeonattribute.png" style="width: 1603px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17798i1EFB109843A474F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42633-routeonattribute.png" alt="42633-routeonattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Failure relation --&amp;gt; RouteonAttribute(check filesize) --&amp;gt;SplitText processor--&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;2.Check the length of the message and route to split text processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In this method we are using the same failure relation to Extract Text Processor.&lt;/P&gt;&lt;P&gt;Add new property in Extract Text Processor to extract all the content of the flow file to an attribute &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Content &lt;/STRONG&gt;as &lt;/P&gt;&lt;PRE&gt;(.*)&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Configs:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42634-extract.png" style="width: 1521px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17799iF88E7305AB19F691/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42634-extract.png" alt="42634-extract.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you are following this method then you need to change the highlighted properties in above screenshot according to your flow file size.&lt;/P&gt;&lt;P&gt;As we are capturing everything by using (.*) regex so you need to change the &lt;/P&gt;&lt;PRE&gt;1.Max capture group length is Specifies the maximum number of characters a given capture group value can have. Any characters beyond the max will be truncated.
2.Maximum Buffer Size is Specifies the maximum amount of data to buffer (per file) in order to apply the regular expressions. Files larger than the specified maximum will not be fully evaluated.&lt;/PRE&gt;&lt;P&gt;So once we are done with this step all the contents of ff is now added as an content attribute to the ff.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;RouteonAttribute Processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Use RouteonAttribute processor and check for length of the content attribute by using NiFi expression language.&lt;/P&gt;&lt;P&gt;length more than 1 as&lt;/P&gt;&lt;PRE&gt;${content:length():gt(1)} //we are having content attribute from extract text processor and using that attribute and checking length of attribute and checking is it greater than 1.&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42635-routeonattribute.png" style="width: 1558px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17800iAC489D2B3E79C1E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42635-routeonattribute.png" alt="42635-routeonattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:-&lt;/STRONG&gt; if your content attribute having value as &lt;STRONG&gt;hi hello&lt;/STRONG&gt; then length will be 8.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Failure Relation --&amp;gt; Extract Text(add property to capture all contents and change buffer size and capture length as per your flow file size) --&amp;gt; RouteOnAttribute(Check the length of attribute and route)--&amp;gt;SplitText processor&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;3.Using Route On Content processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can use RouteonContent processor to check the content of flow file by changing the properties&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1.Match Requirement&lt;/STRONG&gt; property change to&lt;/P&gt;&lt;PRE&gt;content must contain match&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;2.Buffer size &lt;/STRONG&gt;depends on your flow file size&lt;/P&gt;&lt;P&gt;3. add property &lt;STRONG&gt;more than 1 length
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;[a-zA-Z0-9\s+]{1} //check content of flow file with space and Matches exactly 1 times including spaces&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42636-routeoncontent.png" style="width: 1459px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17801i118A9C4A4984FC3E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42636-routeoncontent.png" alt="42636-routeoncontent.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you want to route the messages having more than 1000 length then change the regex to &lt;/P&gt;&lt;PRE&gt;[a-zA-Z0-9\s+]{1000} //Checks flow file content, matches if ff having length of messages more than 1000 including spaces matches with that message.&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Flow:-&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Failure relation --&amp;gt; RouteonContent --&amp;gt;SplitText&lt;/PRE&gt;&lt;P&gt;These are the ways we can filter out the failure relation messages, As you can choose which method best fit for your Case.&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 06:13:03 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2019-08-18T06:13:03Z</dc:date>
    <item>
      <title>nifi handling failures in failure realtionship based on message</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/nifi-handling-failures-in-failure-realtionship-based-on/m-p/197894#M71388</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Thanks a lot to this awesome community.&lt;/P&gt;&lt;P&gt;Is there any way to check for failure messages in failure queue, and route it to appropriate processor back in the flow based on the failure message.&lt;/P&gt;&lt;P&gt;For example, if the message in the failure is "Message is too long", I want it to route it back to splittext processors and split the message and route it again.&lt;/P&gt;&lt;P&gt;Any suggestions or ideas&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dheeru&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 04:01:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/nifi-handling-failures-in-failure-realtionship-based-on/m-p/197894#M71388</guid>
      <dc:creator>dhieru</dc:creator>
      <dc:date>2017-11-16T04:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: nifi handling failures in failure realtionship based on message</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/nifi-handling-failures-in-failure-realtionship-based-on/m-p/197895#M71389</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/20255/dheeruksingh.html" nodeid="20255" target="_blank"&gt;@dhieru singh&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Failure relation messages &lt;STRONG&gt;won't have any write attribute(failure attribute)&lt;/STRONG&gt; that is added to the flow files when the &lt;STRONG&gt;ff are transferred to failure queue&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;But you can use either of &lt;STRONG&gt;below methods&lt;/STRONG&gt; to check the &lt;STRONG&gt;length or size&lt;/STRONG&gt; of the flow files and &lt;STRONG&gt;route to SplitText processors&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;1.Checking size of the flow file and routing to split text processor.&lt;/P&gt;&lt;P&gt;2.Check the length of the message and route to split text processor&lt;/P&gt;&lt;P&gt;3.Using Route On Content processor&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1.Checking size of the flow file and routing to split text processor:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;If you know the size of the flow file that will be having Message is too long then you can use Route on Attribute processor and add new property&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;size more than 1 byte &lt;/STRONG&gt;as&lt;/P&gt;&lt;PRE&gt;${fileSize:gt(1)} //Here we are checking the flow file size is greater than 1 byte&lt;/PRE&gt;&lt;P&gt;So like this way you can filter out the flow files based on the size of the flow file but first you need to know the size of the flow files which are routing to failure.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42633-routeonattribute.png" style="width: 1603px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17798i1EFB109843A474F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42633-routeonattribute.png" alt="42633-routeonattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Failure relation --&amp;gt; RouteonAttribute(check filesize) --&amp;gt;SplitText processor--&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;2.Check the length of the message and route to split text processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In this method we are using the same failure relation to Extract Text Processor.&lt;/P&gt;&lt;P&gt;Add new property in Extract Text Processor to extract all the content of the flow file to an attribute &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Content &lt;/STRONG&gt;as &lt;/P&gt;&lt;PRE&gt;(.*)&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Configs:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42634-extract.png" style="width: 1521px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17799iF88E7305AB19F691/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42634-extract.png" alt="42634-extract.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you are following this method then you need to change the highlighted properties in above screenshot according to your flow file size.&lt;/P&gt;&lt;P&gt;As we are capturing everything by using (.*) regex so you need to change the &lt;/P&gt;&lt;PRE&gt;1.Max capture group length is Specifies the maximum number of characters a given capture group value can have. Any characters beyond the max will be truncated.
2.Maximum Buffer Size is Specifies the maximum amount of data to buffer (per file) in order to apply the regular expressions. Files larger than the specified maximum will not be fully evaluated.&lt;/PRE&gt;&lt;P&gt;So once we are done with this step all the contents of ff is now added as an content attribute to the ff.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;RouteonAttribute Processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Use RouteonAttribute processor and check for length of the content attribute by using NiFi expression language.&lt;/P&gt;&lt;P&gt;length more than 1 as&lt;/P&gt;&lt;PRE&gt;${content:length():gt(1)} //we are having content attribute from extract text processor and using that attribute and checking length of attribute and checking is it greater than 1.&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42635-routeonattribute.png" style="width: 1558px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17800iAC489D2B3E79C1E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42635-routeonattribute.png" alt="42635-routeonattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:-&lt;/STRONG&gt; if your content attribute having value as &lt;STRONG&gt;hi hello&lt;/STRONG&gt; then length will be 8.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Failure Relation --&amp;gt; Extract Text(add property to capture all contents and change buffer size and capture length as per your flow file size) --&amp;gt; RouteOnAttribute(Check the length of attribute and route)--&amp;gt;SplitText processor&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;3.Using Route On Content processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can use RouteonContent processor to check the content of flow file by changing the properties&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1.Match Requirement&lt;/STRONG&gt; property change to&lt;/P&gt;&lt;PRE&gt;content must contain match&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;2.Buffer size &lt;/STRONG&gt;depends on your flow file size&lt;/P&gt;&lt;P&gt;3. add property &lt;STRONG&gt;more than 1 length
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;[a-zA-Z0-9\s+]{1} //check content of flow file with space and Matches exactly 1 times including spaces&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="42636-routeoncontent.png" style="width: 1459px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17801i118A9C4A4984FC3E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="42636-routeoncontent.png" alt="42636-routeoncontent.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you want to route the messages having more than 1000 length then change the regex to &lt;/P&gt;&lt;PRE&gt;[a-zA-Z0-9\s+]{1000} //Checks flow file content, matches if ff having length of messages more than 1000 including spaces matches with that message.&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Flow:-&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Failure relation --&amp;gt; RouteonContent --&amp;gt;SplitText&lt;/PRE&gt;&lt;P&gt;These are the ways we can filter out the failure relation messages, As you can choose which method best fit for your Case.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 06:13:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/nifi-handling-failures-in-failure-realtionship-based-on/m-p/197895#M71389</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T06:13:03Z</dc:date>
    </item>
  </channel>
</rss>

