Member since
07-29-2020
574
Posts
323
Kudos Received
176
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 3549 | 12-20-2024 05:49 AM | |
| 3797 | 12-19-2024 08:33 PM | |
| 3595 | 12-19-2024 06:48 AM | |
| 2331 | 12-17-2024 12:56 PM | |
| 3086 | 12-16-2024 04:38 AM |
07-31-2022
06:21 PM
@KhASQ , Besides @SAMSAL solution, you can also use ReplaceText to eliminate the need of extracting the entire content as an attribute. You'd still have to set a large enough buffer, though, to ensure your largest message could be processed. Cheers, André
... View more
07-21-2022
06:03 AM
1 Kudo
Yes that's the requirement. Thank you so much @SAMSAL , it worked. perfectly, Could you please help me any sources to get used to these xml scripts.
... View more
07-13-2022
11:20 PM
1 Kudo
@Lewis_King , Here's an idea. You can fork the "a" output of the QueryRecord processor and send it to a sequence of processors as shown below: The ReplaceText processor will simply replace the entire contents of the flowfile with the information you want to register in the log. For example: This will produce one row per flow file with the source type ("a") and the timestamp. You can them send these to a MergeRecord to avoid saving to many small log files and them to a PutFile to persist the log. You can process the "b" output in a similar way. Cheers, André
... View more
07-12-2022
05:41 PM
I am an absolute newbie and was following other tutorials. 😂 I thought it was necessary to convert it to JSON to store the data into Postgresql. Thanks a lot for the help !
... View more
07-11-2022
11:21 AM
You cant use Expression Language when setting values in the JsonPathReader processor. You need to get the value first as is using the json path and then use an updateAttribute processor on it using the expression above. In updateAttribute you can use the same variable name or different one.
... View more
07-10-2022
11:55 PM
Hi @SAMSAL , thank you for your help, but you're absoluty right in your second post - the first one seems very "uncomfortable". @MattWho: I really don't care about the content, i've created backup-files in the stages before mailing and only the consumed filenames are relevant for mail. Last time there was 350 files and 35MB for backup 😉
... View more
07-09-2022
12:45 PM
1 Kudo
Hi, If your configurations are similar to mine then I would suggest that you test it on version 1.16.0 to see if its a bug with version 1.16.2 which in this case needs to be reported. Another option for you is to write custom code using ExecuteScript processor that will generate a different flowfile for each json record since the ExecuteProcess wont have this option and would write everything in the output steam into one flowfile. you can refer to the following post to help you generate multiple flowfiles: https://community.cloudera.com/t5/Support-Questions/Split-one-Nifi-flow-file-into-Multiple-flow-file-based-on/m-p/203387 Another option you can try incase there is a problem with the SplitContent processor is to create every json record in a different line and then try to split them using SplitText processor and set the property "Split Line Count" to 1
... View more
07-06-2022
01:54 AM
1 Kudo
@araujothe next step is with InvokeHTTP processor to update the stocks of products via Rest Endpoint
... View more
07-04-2022
02:00 AM
Thanks. Using examples from that cookbook, I could make it work. Here is my code which works: from org.apache.commons.io import IOUtils
from java.nio.charset import StandardCharsets
from org.apache.nifi.processor.io import OutputStreamCallback
class PyOutputStreamCallback(OutputStreamCallback):
def __init__(self):
pass
def process(self, outputStream):
with open("D:\\Work\\nifi test\\custom processor input\\random_json.json") as f:
file_content = f.read()
outputStream.write(bytearray(file_content.encode('utf-8')))
flowFile = session.create()
if(flowFile != None):
flowFile = session.write(flowFile, PyOutputStreamCallback())
flowFile = session.putAttribute(flowFile, "filename", 'input_file.json')
session.transfer(flowFile, REL_SUCCESS)
session.commit() Next, I will figure out if I can add the local directory path as a property and read that, instead of hardcoding it in the script.
... View more