Member since
08-06-2018
21
Posts
1
Kudos Received
0
Solutions
08-29-2023
08:39 AM
Can you help me with a similar issue? My code: import json import collections import java.io import ast from org.apache.commons.io import IOUtils from java.nio.charset import StandardCharsets from org.apache.nifi.processor.io import StreamCallback class ModJSON(StreamCallback) : def __init__(self): pass def process(self, inputStream, outputStream): text = IOUtils.toString(inputStream, StandardCharsets.UTF_8) obj = ast.literal_eval(text) mail = obj['mail'] outputStream.write(bytearray(json.dumps(obj['mail'], indent=4).encode('utf-8'))) outputStream.write(bytearray(json.dumps(obj['id'], indent=4).encode('utf-8'))) flowFile = session.get() if (flowFile != None): flowFile = session.write(flowFile, ModJSON()) flowFile = session.putAttribute(flowFile, "filename", flowFile.getAttribute('filename').split('.')[0]+'_translated.json') flowFile = session.putAttribute(flowFile, "mail", mail) session.transfer(flowFile, REL_SUCCESS) session.commit() I want to get "mail" value and create a new attribute for it. However, mail variable is not accessible when I insert it into the putattribute command. Any feedback?
... View more
08-31-2018
09:57 PM
1 Kudo
There is a full Python client for NiFi, NiFi-Registry, and I'm just about to add the Schema-Registry as well. https://github.com/Chaffelson/nipyapi It is community supported and comes with all the basic calls you would need to automate your NiFi flows, higher level functions for complex tasks like 'stop all processors in this process group and purge all the queues', and demos of various usage methods like tokenAuth security, promoting flow versions between environments, and deploying NiFi in Docker containers for testing.
... View more
08-23-2018
06:43 AM
How do you initialize/load the Azure libs? Maybe you will have to configure the workdir in your processor as well? Do you have any error log? Anyway it might be a good idea to close this issue (by accepting one answer) and create a new post with the next issue your are facing (your script seems to not connect correctly).
... View more
08-08-2018
03:39 PM
@Bharath
Sudharsanam
Hmm, If possible please share your flow template (or) all the processors that you are using and configs screenshots of them.
... View more
08-08-2018
02:22 AM
@Bharath
Sudharsanam
Yes, leave the Fetch File processor property as default. processor will fetches those files from the directory.
... View more