Member since
05-20-2022
66
Posts
6
Kudos Received
6
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 2282 | 07-17-2023 11:25 PM | |
| 2373 | 04-17-2023 02:29 PM | |
| 9073 | 02-15-2023 08:47 PM | |
| 1670 | 02-08-2023 06:02 PM | |
| 8466 | 10-17-2022 11:48 AM |
10-06-2022
11:42 AM
Brilliant! That does the trick. Thanks!
... View more
10-06-2022
08:20 AM
Are you suggesting it is possible to perform a complete swap of the flow file content using a ReplaceText processor? For example: If the flow file = "ababababac" Can I use a single ReplaceText to create <xml>ababababac</xml>? From everything I've read in the docs you can't use the Expression Language to get at the whole of the flow file content, e.g. ${flowFile} So instead what I do is use 2 ReplaceText processors successively; the first one performs a "Prepend", and the second one performs an "Append". This technique just bookends (brackets) the flow file content. For example: Base64Encode ReplaceText (prepend) ReplaceText(append) ababababac ==> <xml>ababababac ==> <xml>ababababac</xml> But, if you know of a way to do this with a single processor then I'd love to hear your suggestions. Thanks!
... View more
10-04-2022
04:49 PM
How can I use the output of the Base64EncodeContent (or the Base64Encode function) as input for an XML template, where the flow file content (not an attribute) is the XML with the encoded value included? There doesn't seem to be a NiFi reader that reads the encoded flow file content, so I'm not sure how best to use this processor aside from using a couple of ReplaceText processors to bracket XML substrings around it. I appreciate any input. Thanks for reading. example: Initial Flow File: "The quick brown fox jumped over the lazy dog" Encoded Flow File: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c= <?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="some/name/space/goes/here">
<b>This is a template</b>
<c>ENCODED DATA GOES HERE</c>
</a>
... View more
Labels:
- Labels:
-
Apache NiFi
09-27-2022
11:26 AM
Brilliant! Exactly what I was looking for. Although it seems a little peculiar to me that we need to rely on a Jolt transform for this operation and not the UpdateRecord processor. Particularly since NiFi makes it a point to discuss Arrays and Maps in the documentation. Thanks for the Jolt transform because I spent a lot of time trying to get the Jolt transform to work and couldn't quite figure it out. Now I see what I was doing wrong.
... View more
09-26-2022
07:26 PM
If I have a flow file with the following JSON how can I 1) Evaluate "addresses" to determine if it is of type Array or type Map 2) If type Map then convert "addresses" into an array using native NiFi capabilities (i.e. no string parsing)? {
"name": "John Doe",
"addresses": {
"work": {
"number": "123",
"street": "5th Avenue",
"city": "New York",
"state": "NY",
"zip": "10020"
}
}
} This is what I need it to look like: {
"name": "John Doe",
"addresses": [{
"work": {
"number": "123",
"street": "5th Avenue",
"city": "New York",
"state": "NY",
"zip": "10020"
}
}]
} I appreciate the input and support! Thank you.
... View more
Labels:
- Labels:
-
Apache NiFi
09-19-2022
10:03 PM
Thanks @SAMSAL and @araujo for the responses. The RouteOnAttribute is what I am using presently but it gets unwieldily after just a couple of route options. Looks like I'm just gonna need to build a custom validator using the ExecuteScript processor. Hopefully that scales.
... View more
09-18-2022
05:28 PM
Thank you SAMSAL for the reply. Ordinarily you would be correct, however, the ValidateXML processor does things differently. If my flowfile has an attribute named "schema.name" and I use the following expression language: ${schema.name:prepend('/opt/nifi/schemas/xsd/'):append('.xsd')} ...then I get the following error. It seems the ValidateXML processor doesn't actually support dynamic run-time assignment of variables. Even using the variable registry doesn't solve the problem because the path/filename variable needs to resolve at design time. Perform Validation. Component is invalid: 'Schema File' validated against '/opt/nifi/schemas/xsd/.xsd' is invalid because The specified resource(s) do not exist or could not be accessed: [/opt/nifi/schemas/xsd/.xsd] Hopefully there is something I'm missing, otherwise I'll have to use the ExecuteScript to build my own validation routine. @ChuckE wrote: I have about 25-30 XML message types and each message type has its own XSD. I need to validate each message against their respective XSD. When using the ValidateXML processor is there any way to dynamically assign the appropriate XSD to a flow file based on on attribute value? I don't see the purpose/benefit of using so-called variables when said variables aren't even variable--they are STATIC! Why does this processor ONLY use variable_registry variables and not attribute values like every other processor in NiFi?
... View more
09-16-2022
10:14 PM
I have about 25-30 XML message types and each message type has its own XSD. I need to validate each message against their respective XSD. When using the ValidateXML processor is there any way to dynamically assign the appropriate XSD to a flow file based on on attribute value? I don't see the purpose/benefit of using so-called variables when said variables aren't even variable--they are STATIC! Why does this processor ONLY use variable_registry variables and not attribute values like every other processor in NiFi?
... View more
Labels:
- Labels:
-
Apache NiFi
08-03-2022
07:59 PM
1 Kudo
I create an XMLRecordSetWriter in the Controller Services, then using a ConvertRecord processor I'm able to read the xml record and then immediately write it out with a new root tag, which I can then pass to my next processor. I discovered this when I was reading the documentation for the XMLRecordSetWriter. Very first line in the documentation. 😃 https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.7.0/org.apache.nifi.xml.XMLRecordSetWriter/index.html
... View more