Support Questions

Find answers, ask questions, and share your expertise

Fetch file located on directory specified by HTTP request

New Contributor

Hello, I've been struggling trying to find a way to deliver my goal without success, hence i'm here asking you for help .

Basically i've got a folder tree like this

data \

dir1\

a (lastModified: it's the most recent)

b (lastModified: not the most recent)

dir2\

c (lastModified: it's the most recent)

dir3\

I would like to retrieve the most recent files from one of the subfolders specified by an HTTP request, so for instance:

ListFile and FetchFile would retrieve files named "a" and "c" (which are the most recent) while from HandleHttpRequest i would receive the path name "dir1". Thus merging the two flows (theoretically with RouteOnAttribute) i would only get file "a" which i would send back to the client with HandleHttpResponse.

Thanks for the attention 🙂

97631-schermata-da-2019-01-22-14-24-03.png

2 REPLIES 2

Master Guru
@Manfredi

-

Can you provide some more details on your use case? I am not following complete on reason for HandleHTTPRequest in your flow.
How have you configured your RouteOnAttribute processor? Any FlowFile that comes form FetchFile to this RouteOnAttribute which happens to route to your ContainsRobotId relationship will fail at the HandleHTTp Response processor. The RouteOnAttribute processor will not merge FlowFiles.

-

Thank you,
Matt

New Contributor

Hi @Matt Clarke, thanks for you help. Basically i got a client which wants to retrieve files from a local storage. Inside local storage resides multiple folders ( which i've called dir1,dir2,ecc in this example) which contain different "robot" sensing data and each folder name is defined by a proper "robotId". Thus the client who wants to access sensing data of robotId: "R_123_A" needs to retrieve from the local storage, the file whose absolute path is "data/R_123_A/sensing-timestamp.txt "

RouteOnAttribute isn't properly set right now but what it should do is checking something like this :
absolute_path.contains(robotId)

So i want RouteOnAttribute to merge attributes from the 2 different flowfiles to check if the flowfile coming out from fetchfile has got in its absolute path the proper robotId set on the flowfile coming out from the httprequest by the client.


I'm aware routeOnAttribute can't merge two flowfiles but i wanted to easily explain my problem ( i failed apparently ^-^). Are there any solutions for this kind of problem?

Once again thanks,

Manfredi

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.