<?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 ExecuteScript alternative to InvokeHTTP processor: Login only once in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-alternative-to-InvokeHTTP-processor-Login/m-p/200146#M162177</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/1651/menorah84.html" nodeid="1651"&gt;@J. D. Bacolod&lt;/A&gt;&lt;P&gt;Have you considered using the PutDistributedMapCache and GetDistributedMapCache processors?&lt;/P&gt;&lt;P&gt;Have two separate dataflows.  One runs on a cron and is responsible for obtaining the token and write that token to the distirbutedMapCache using the putDistirbutedMapCache processor.&lt;/P&gt;&lt;P&gt;The Second flow is for doing all your other operations using that token.  Just before the invokeHTTP processor add a GetDistibutedMapCache processor that reads the token from the distributed map cache in to a FlowFile attribute. You then use that attribute to pass the token in your connections.&lt;/P&gt;&lt;P&gt;One thing to keep in mind is that it is possible that a new token may be retrieved after a FlowFile had already retrieved the old token from the distirbutedMapCache.  This would result in auth failure.  So you will want your flow to loop back to GetDistributedMapChace processor to get latest key on auth failure on your invokeHTTP processor.&lt;/P&gt;&lt;P&gt;This flow does not keep track in any way when a token expires, but if you know how long a token is good for you can set your cron accordingly.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jun 2017 21:29:33 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2017-06-07T21:29:33Z</dc:date>
  </channel>
</rss>

