I have a groovy scripts that I am running inside of a ExecuteGroovyScript
processor (nifi v 1.12.0)
I've been following the examples at
https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-2/ta-p/249018,
and I have something like:
flowFile = session.get()
if(!flowFile) return
flowFile = session.write(flowFile, {outputStream ->
... do stuff
try {
...
// do thing that throws
...
outputStream.write(responseBytes)
session.transfer(flowFile, REL_SUCCESS)
}
catch {
// the below line ALWAYS throws
session.transfer(flowFile, REL_FAILURE)
} as OutputStreamCallback)
But it throws an error at the session.transfer line.
ExecuteGroovyScript[id=b3951944-10f5-1175-dfa8-3c9d28fe448e]
java.lang.IllegalStateException:
StandardFlowFileRecord[uuid=beef7ed3-1822-420d-839c-1c07b4f2d1c5,claim=StandardContentClaim
[resourceClaim=StandardResourceClaim[id=1603715925064-433, container=default,
section=433], offset=3086,
length=11],offset=0,name=6d7ccd7a-13be-43e1-b29b-0431bfaacec3,size=11] already
in use for an active callback or an OutputStream created by
ProcessSession.write(FlowFile) has not been closed:
java.lang.IllegalStateException:
StandardFlowFileRecord[uuid=beef7ed3-1822-420d-839c-1c07b4f2d1c5,claim=StandardContentClaim
[resourceClaim=StandardResourceClaim[id=1603715925064-433, container=default,
section=433], offset=3086,
length=11],offset=0,name=6d7ccd7a-13be-43e1-b29b-0431bfaacec3,size=11] already
in use for an active callback or an OutputStream created by
ProcessSession.write(FlowFile) has not been closed
I've tried throwing around outputStream.close() everwhere, but that doesn't
seem to help.
What am I missing?
Thx
Geoffrey Greene
Senior Software Ninjaneer
(703) 414 2421
The Boeing Company