- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
FetchFile x Windows
- Labels:
-
Apache NiFi
Created 09-27-2022 12:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good afternoon,
Is there a way to use the FetchFile 1.16.2 processor to access files from Windows when the Nifi application is on Linux?
Created 09-28-2022 05:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the flow I'm working on, I'm using the UpdateAttribute to enter the path of a Windows network directory to get the .PDF files, but it throws the error below.
I must be doing something wrong or missing some other processor.
UpdateAttribute
Created 09-28-2022 06:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FetchFile gets the file from the host system, in your case try GetSmbFile or mount remote share into Linux first and then use FetchFile.
Created 09-28-2022 08:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for your tip, it worked, but I have some doubts about how to use this GetSmbFile processor.
1 - I need to send a formatted E-mail body for each case and I would be able to do that with the previous processors I was using. How can I do this?
2 - Is there a way for the PDF file to be moved from one directory to another with this processor? I noticed that it manages to delete the file from the directory, but that is not what I wanted, I would like to move it from a send to sent directory for example.
3 - Is it an input-only processor? I can't connect it to any other processor before? Is he the first in the stream?
Created on 09-29-2022 12:12 AM - edited 09-29-2022 12:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1 - it accepts no incoming connections, so I'd rather rebuild process around it or used distributed cache services. Try something like this:
- get file from smb
- put file to distributed cache while keeping it's identifier in an attribute
- generate email body with replacetext or w/e you use and put it into attribute
- fetch file from distributed cache
use putemail with Attach File - true and Flow file content as message - false, set Message as an attribute with a body.
2 - process deletes files when Keep Source File property set to "false" (default configuration), to move file combine GetSmbFile (Keep Source File to false) with PutSmbFile.
3 - yep, as mentioned in 1, it's input/flowfile-generative processor, it should stay first in the stream.
Created 09-29-2022 06:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I store the Flow content that brings the PDF to a property so the content doesn't get lost in the Nifi Flow?
Created on 09-29-2022 07:12 AM - edited 09-29-2022 07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You store it into the cache with PutDistributedMapCache processor, you need the property to fetch the file back. DistributedMapCacheClientService controller and DistributedMapCacheServer controller are used with beforementioned processor.
When you need the pdf you use FetchDistributedMapCache and get the flowfile back into the flow.
Created 09-29-2022 10:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would you have any example to give me about the functioning of these processors?
Sorry for my little knowledge.
Created 09-30-2022 03:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I made two sample flows:
the simple one just to put pdf almost straight to email:
And here is the one with caches, if you have a complex process to build email body:
Use default configs for these two controllers, at first it should be enough
Increase entry size accordingly to your max pdf size, for Identifier use either filename or whatever you think does the job:
Use same Identifier to fetch object
Created 09-30-2022 07:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to make an example with the model you gave me, but when I get to the PutDistributedMapCache processor it gets stuck and doesn't go forward, neither success nor failure.
Am I doing something wrong with the Distributed Cache Service?
