Member since
08-26-2017
20
Posts
3
Kudos Received
0
Solutions
12-07-2017
08:48 AM
As per the Nifi API documentation: GET
/process-groups/{groupId}/variable-registry/update-requests/{updateId}
Gets a process group's variable registry
DELETE
/process-groups/{groupId}/variable-registry/update-requests/{updateId}
Deletes an update request for a process group's variable registry. If the request is not yet complete, it will automatically be cancelled.
GET
/process-groups/{id}
Gets a process group
PUT
/process-groups/{id}
Updates a process group But, the call is /nifi-api/flow/process-groups. Any idea if this is a documentation issue ?
... View more
12-04-2017
01:37 AM
@Matt / @Peter, I have faced problems if incorrect input is passed to ExecuteScript processor and it would need some manual intervention to cleanup the 'buggy' flowFile. The job fails on Production and keeps retrying if we dont route the incorrect flowFile to FAILURE. I generally use try-catch strategy to move the incorrect flowFiles to FAILURE path and add the exception as a attribute that finally gets logged in nifi-app.log.
Modified example below using Peter's if construct-
if (flowFile!=None):
try:
reader = PyStreamCallback()
flowFile = session.write(flowFile,reader)
flowFile = session.putAttribute(flowFile,'ThisIsAnAttributeName',reader.thing())
session.transfer(flowFile, REL_SUCCESS)
except Exception as e:
attrMap = {}
attrMap["Script.Exception"] = e
session.putAllAttribute(flowFile,attrMap)
session.transfer(flowFile, REL_FAILURE)
... View more
11-16-2017
11:06 AM
For Python fans: class PyStreamCallback(StreamCallback):
def __init__(self,tmp_dir):
self.tmp_dir = tmp_dir
pass
def process(self, inputStream, outputStream):
# modified the input attribute of tmp_dir ,and writes it out
text = IOUtils.toString(inputStream, StandardCharsets.UTF_8)
tmp_dir = self.tmp_dir + '_modified'
outputStream.write(bytearray(tmp_dir.encode('utf-8')))
flowFile = session.get()
if (flowFile != None):
tmp_dir = flowFile.getAttribute('tmp_dir')
flowFile = session.write(flowFile,PyStreamCallback(tmp_dir))
... View more
11-16-2017
10:54 AM
1 Kudo
@Matt Burgess You are a Saviour !! Thanks for this cookbook. This is Gold !!
... View more