<?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 can I enrich flow file attributes with data read from a file? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201285#M62596</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18880/danielfrank.html" nodeid="18880"&gt;@Daniel Frank&lt;/A&gt; &lt;/P&gt;&lt;P&gt;If you use &lt;A rel="user" href="https://community.cloudera.com/users/525/mclark.html" nodeid="525"&gt;@Matt Clarke&lt;/A&gt; in your response, I do not get an email notification.&lt;/P&gt;&lt;P&gt;I am not following how you use the filename and path to file (B) to parse a totally different file (C) from the filesystem.&lt;/P&gt;&lt;P&gt;Have you looked at the FetchFile processor.  It accepts a FlowFile as input and uses attributes set on the incoming FlowFile to specify what file to fetch and from where.&lt;/P&gt;&lt;P&gt;So you could getFile (B), extract what you need from file (B) into attributes that FetchFile can use to get File (C).  FetchFile will stream the content of file (C) into the FlowFile originally belonging to File (B); however, the resulting FlowFile will retain all the FlowFile Attributes that already existed on FlowFile (B).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;If you found this answer addressed your question, please mark as accepted to close out this thread in the community.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2017 23:08:08 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2017-06-08T23:08:08Z</dc:date>
    <item>
      <title>,How can I enrich flow file attributes with data read from a file?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201282#M62593</link>
      <description>&lt;P&gt;I've got to watch a directory that includes subdirectories. Every file I receive in any subdirectory needs to be processed, but the details depend on the subdirectory and the filename, for some subdirectories I have to send an email, for others I have to execute one or more commands, store the file at a specific location, etc. Multiple actions per flow file are possible as well.&lt;/P&gt;&lt;P&gt;I'm currently stuck on setting the attributes of the flowfile.&lt;/P&gt;&lt;P&gt;My current plan is as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;GetFile processor to watch the directory A creates flow file B&lt;/LI&gt;&lt;LI&gt;InvokeScriptedProcessor uses attributes like B.filename and B.path to read and parse file C from the filesystem and updates the attributes, such as sftp server, email [addresses, subject and body] and commands to execute on flow file B&lt;/LI&gt;&lt;LI&gt;RouteOnAttribute to the sftp workflow&lt;/LI&gt;&lt;LI&gt;RouteOnAttribute to the email workflow&lt;/LI&gt;&lt;LI&gt;RouteOnAttribute to the command execution workflow&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Is there a sane alternative to writing my own processor for task 2? The data file format of file C is pretty much up to me to define.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 21:18:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201282#M62593</guid>
      <dc:creator>daniel_frank</dc:creator>
      <dc:date>2017-06-08T21:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: ,How can I enrich flow file attributes with data read from a file?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201283#M62594</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/106673/how-can-i-enrich-flow-file-attributes-with-data-re.html#" rel="nofollow noopener noreferrer" target="_blank"&gt;@Daniel Frank&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What format is your data in?   (text?)&lt;/P&gt;&lt;P&gt;Is all the information you need in the content of these files?&lt;/P&gt;&lt;P&gt;The getFile processor already writes attributes for the following on every FlowFile it creates:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="16123-screen-shot-2017-06-07-at-32159-pm.png" style="width: 3242px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17463iEA9186226941A252/image-size/medium?v=v2&amp;amp;px=400" role="button" title="16123-screen-shot-2017-06-07-at-32159-pm.png" alt="16123-screen-shot-2017-06-07-at-32159-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You could use the ExtractText processor to read the FlowFile content and extract bits to FlowFile Attributes.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 05:33:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201283#M62594</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-08-18T05:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: ,How can I enrich flow file attributes with data read from a file?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201284#M62595</link>
      <description>&lt;P&gt;My description was unclear about an important point, I have updated it.&lt;/P&gt;&lt;P&gt;Using the filename and path attributes of the flowfile I have to parse a file in the filesystem (or maybe query a database) to figure out what exactly needs to be done to the flow file contents.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 21:18:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201284#M62595</guid>
      <dc:creator>daniel_frank</dc:creator>
      <dc:date>2017-06-08T21:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: ,How can I enrich flow file attributes with data read from a file?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201285#M62596</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18880/danielfrank.html" nodeid="18880"&gt;@Daniel Frank&lt;/A&gt; &lt;/P&gt;&lt;P&gt;If you use &lt;A rel="user" href="https://community.cloudera.com/users/525/mclark.html" nodeid="525"&gt;@Matt Clarke&lt;/A&gt; in your response, I do not get an email notification.&lt;/P&gt;&lt;P&gt;I am not following how you use the filename and path to file (B) to parse a totally different file (C) from the filesystem.&lt;/P&gt;&lt;P&gt;Have you looked at the FetchFile processor.  It accepts a FlowFile as input and uses attributes set on the incoming FlowFile to specify what file to fetch and from where.&lt;/P&gt;&lt;P&gt;So you could getFile (B), extract what you need from file (B) into attributes that FetchFile can use to get File (C).  FetchFile will stream the content of file (C) into the FlowFile originally belonging to File (B); however, the resulting FlowFile will retain all the FlowFile Attributes that already existed on FlowFile (B).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;If you found this answer addressed your question, please mark as accepted to close out this thread in the community.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 23:08:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201285#M62596</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2017-06-08T23:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: ,How can I enrich flow file attributes with data read from a file?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201286#M62597</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/525/mclark.html" nodeid="525"&gt;@Matt Clarke&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks, that answer my question.  I have to move the contents of the flowFile B to its attributes, then fetch file C and parse it with more processors to set more attributes on the flowfile and finally restore the contents of the flowfile to what I saved to the attributes.&lt;/P&gt;&lt;P&gt;Sound's like I'll go with a scripted processor instead, that will save a lot of headache for me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 23:21:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-enrich-flow-file-attributes-with-data-read-from-a/m-p/201286#M62597</guid>
      <dc:creator>daniel_frank</dc:creator>
      <dc:date>2017-06-08T23:21:48Z</dc:date>
    </item>
  </channel>
</rss>

