Member since
03-11-2016
2
Posts
8
Kudos Received
0
Solutions
03-11-2016
07:41 PM
1 Kudo
Thank you very much for this answer!
... View more
03-11-2016
08:08 AM
7 Kudos
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
.Builder().name("Add Attribute")
.description("Example Property")
.required(true)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(true)
.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
Labels:
- Labels:
-
Apache NiFi