[ 
https://issues.apache.org/jira/browse/NIFI-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16591830#comment-16591830
 ] 

James Srinivasan commented on NIFI-830:
---------------------------------------

Afraid I can't easily share the flow, but it looks a bit like this:

 

1) GetFile reads files containing a list of URLs from the filesystem, and 
populates the filename attribute with the filename from which those URLs came 
e.g. file1.txt

2) SplitText separates out each line

3) InvokeHTTP fetches the URL (which is a JSON object)

4) EvaluateJSONPath extracts a value from the JSON e.g. 12345

5) UpdateAttribute updates the filename attribute to contain the source 
filename (from #1) followed by the extracted value (#4) e.g. file1.txt-12345

6) PutFile writes the results to a directory using the updated filename from #5

Hope this makes sense

 

One alternative option might be a new processor parameter to update the 
filename, defaulting to false for backwards compatibility.

> For GET requests, InvokeHTTP should set the filename of the 'Response' 
> FlowFile based on the URL
> ------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-830
>                 URL: https://issues.apache.org/jira/browse/NIFI-830
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Mark Payne
>            Priority: Minor
>              Labels: beginner, newbie
>         Attachments: 
> 0001-NIFI-830-core-attribute-flowfileName-will-be-last-se.patch
>
>
> When using InvokeHTTP to fetch the content of a particular URL, I expected 
> that the filename of the 'Response' FlowFile would be set to the filename 
> pulled. I.e., if I pulled http://www.somesite.com/images/1.png, I would have 
> expected the 'Response' FlowFile to have a filename of "1.png" but instead it 
> had the same filename as the incoming FlowFile.
> I don't think this is something that we can change until version 1.0.0 
> because it could potentially break backward compatibility of flows by 
> changing the filename unexpectedly. In the meantime, I have added an 
> UpdateAttribute to set the filename to 
> ${url:substringAfterLast('/'):substringBefore('?')}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to