Hi James, I am not in a position to test this right now, but you have to think of the flowfile content as STDIN and STDOUT. So with 7zip you need to use the “-si” and “-so” flags to ensure there are no files involved. Then if you can load the content of a file into a flowfile, eg with GetFile, then you should be able to unpack it with ExecuteStreamCommand. Set “Ignore STDIN” = “false”.
I have written up my own use case on github. This involves having a Redis script as the input, and results of the script as the output. my-nifi-cluster/experiment-redis_direct.md at main · hindmasj/my-nifi-cluster · GitHub<https://github.com/hindmasj/my-nifi-cluster/blob/main/docs/experiment-redis_direct.md> The first part of the post shows how to do it with the input commands on the command line, so a bit like you running “7za ${filename} -so”. The second part has the script inside the flowfile and is treated as STDIN, a bit like you doing “unzip -si -so”. See if that helps. Fundamentally, if you do “7za -si -so < myfile.7z” on the command line and see the output on the console, ExecuteStreamCommand will behave the same. Steve Hindmarch From: James McMahon <[email protected]> Sent: 28 September 2022 12:02 To: [email protected] Subject: Can ExecuteStreamCommand do this? I continue to struggle with ExecuteStreamCommand, and am hoping one of you from our user community can help me with the following: 1. Can ExecuteStreamCommand be used as I am trying to use it? 2. Can you direct me to an example where ExecuteStreamCommand is configured to do something similar to my use case? My use case: The incoming flowfiles in my flow path are 7z zips. Based on what I've researched so far, NiFi's native processors don't handle unpacking of 7z files. I want to read the 7z files as STDIN to ExecuteStreamCommand. I'd like the processor to call out to a 7za app, which will unpack the 7z. One incoming flowfile will yield multiple output files. Let's say twelve in this case. My goal is to output those twelve as new flowfiles out of ExecuteStreamCommand, to its output stream path. I can't yet get this to work. Best I've been able to do is configure ExecuteStreamCommand to unpack ${filename} to a temporary output directory on disk. Then I have another path in my flow polling that directory every few minutes looking for new data. Am hoping to eliminate that intermediate write/read to/from disk by keeping this all within the flow and JVM memory. Thanks very much in advance for any assistance.
