I am trying to use NiFi to break up an XML document into multiple flowfiles. The XML contains many elements from a web service. I am trying to process each event separately. I think EvaluateXQuery is the appropriate processor but I can't figure out to add my XQuery if the destination is a flowfile rather than an attribute. I know I have to add a property /value pair in the processor config/properties page but I can't figure out what the property name should be. Does it matter?
1
votes
1 Answers
0
votes
If you only need to extract one element, then yes, add a dynamic property with any name and set the destination to flowfile-content.
You can add multiple dynamic properties to the processor to extract elements into attributes on the outgoing flowfile. If you want to then replace the flowfile content with the attributes, you can use a processor like ReplaceText
or AttributesToJson
to combine multiple attributes into the flowfile content.
A couple things to remember:
- extracting multiple large elements to attributes is an anti-pattern, as this will hurt performance on the heap
- you might be better off splitting the XML file into chunks via
SplitXML
first in order to then extract a single element per chunk into the flowfile content (or an attribute)