Object in the flow stuck between PutFile and ExecuteScript for longer time than expected.
when I am using PutFile Processor and ExecuteScript Processor,the object in the flow between them stuck for longer time than expected and processed many times.
this case happend only between these 2 processors only.
even if I set the expiration time for the flow and set it to 1 second, and scheduled the run of ExecuteScript to 4 sec, still processing the flow at least 2 times.
which cause sending the file to the API many times.
the version of the NIFI I am usnig is: NIFI v1.18, also I tried to upgrade and use version 1.22, but this issue still as is.
The script I am using in ExecuteScript is:
import org.apache.commons.io.IOUtils
import org.apache.nifi.processor.io.OutputStreamCallback
def flowFile = session.create()
def filePath = 'E:/tmp/tmp_file.txt'
def file = new File(filePath)
if (file.exists()) {
def fileContent = IOUtils.toByteArray(new FileInputStream(file))
flowFile = session.write(flowFile, { outputStream ->
outputStream.write(fileContent)
} as OutputStreamCallback)
session.transfer(flowFile, REL_SUCCESS)
} else {
session.remove(flowFile)
// Handle file not found or other error
}


