A quick read of the 7-zip command line guide suggests you need the option “-si” to read from stdin.
Steve Hindmarch From: James McMahon <[email protected]> Sent: 21 September 2022 17:01 To: [email protected] Subject: Re: ExecuteStreamCommand fails to extract archived files Now I see. So in the configuration of the ExecuteStreamCommand there was one thing we had not touched on, and it allowed this to work: Ignore STDIN must be set to true. I did that, I set my Command Arguments to e;/mnt/in/${filename} , and it worked as expected. Thanks again Mike. Jim On Wed, Sep 21, 2022 at 11:50 AM Mike Thomsen <[email protected]<mailto:[email protected]>> wrote: > ExecuteStreamCommand works on the contents of the incoming flowfile, is that > understanding correct? 7za can't read the file from stdin. That's the problem AFAICT in your scenario. On Wed, Sep 21, 2022 at 11:26 AM James McMahon <[email protected]<mailto:[email protected]>> wrote: > > Thank you Mike. May I ask a few follow-up Qs after trying this and failing > still? > > ExecuteStreamCommand works on the contents of the incoming flowfile, is that > understanding correct? If so, then why does it matter where the file sits on > the filesystem if it will apply /bin/7za to the flowfile in the stream? > > So I have /bin/7za in the /bin directory, it's an executable program, and the > user that the nif jvm is running as - user named nifi - has /bin in its path. > > I have an archive file I created in directory /mnt/in, and it is named > testArchive.7z. I am successfully able to read that archive file in with a > ListFile / FetchFile, and do get it in my stream. These are its attributes: > absolute.path /mnt/in/ > filename testArchive.7z > > Is this java io exception telling us that it can't find the /bin/7za program, > or it can't find the data itself? And if ExecuteStreamCommand is supposed to > be applying that command to the flowfile in the stream, why is it important > that the archive file exists on disk where ExecuteStreamCommand can find it? > > On Wed, Sep 21, 2022 at 11:07 AM Mike Thomsen > <[email protected]<mailto:[email protected]>> wrote: >> >> To do this, you need to do UpdateAttribute (to set the temp folder >> location) -> PutFile -> ExecuteStreamCommand to ensure the flowfile's >> contents are staged where 7za can find them. >> >> I think the appropriate parameter would be something like this: >> >> Command Arguments: e;${path}/${filename} >> >> Assuming ";" is the argument delimiter. >> >> On Wed, Sep 21, 2022 at 10:45 AM James McMahon >> <[email protected]<mailto:[email protected]>> wrote: >> > >> > Hello. I have a program /bin/7za that I need to apply to flowfiles that >> > were created by 7za. One of them is testArchive.7z. >> > >> > I try to employ an ExecuteStreamCommand to extract from an incoming >> > flowfile to into N output flowfiles in output stream, each representing >> > one file from the contents in the flowfile. >> > >> > ESC throws error=2, No such file or directory. >> > >> > java.io.Exception: Cannot run program "/bin/7za"": error=2, No such file >> > or directory >> > >> > My ExecuteStreamCommand processor has this configuration: >> > Command Arguments e >> > Command Path /bin/7za >> > Ignore STDIN false >> > working Directory no value set >> > Argument Delimiter ; >> > (I do not set an Output Destination Delimiter, intending to send the >> > output to output path "output stream" as separate flowfiles) >> > >> > How can I fix this problem? >> > >> > Thanks in advance, >> > Jim
