I'm trying to make a custom processor in Apache NiFi that can add an attribute/string to the JSON object in the flowfile content. At the moment it works when I just use a string but it's not working when I use NiFi's expression language although I have it supported in my code. The expression language is 100% correct as it works in another processor and I've also tried different attributes to make sure it's not the attribute.
The property: public static final PropertyDescriptor ADD_ATTRIBUTE = new PropertyDescriptor
.build(); Later in my code when I want to get the value and put in the JSON object I use: jsonObject.put("hostname", context.getProperty(ADD_ATTRIBUTE).evaluateAttributeExpressions().getValue()); I also made a Unit Test and it works when I assign a text value to the testrunner.setProperty. However I don't know how I can assign an attribute to the testrunner or how I can use expression language in my test.
Thanks in advance for any suggestions or a solution!
... View more