mattyb149 commented on a change in pull request #3543: NIFI-6388 Add dynamic
relationships to the ExecuteScript processor.
URL: https://github.com/apache/nifi/pull/3543#discussion_r409218558
##########
File path:
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java
##########
@@ -216,14 +329,21 @@ public void onTrigger(ProcessContext context,
ProcessSessionFactory sessionFacto
bindings.put("log", log);
bindings.put("REL_SUCCESS", REL_SUCCESS);
bindings.put("REL_FAILURE", REL_FAILURE);
+ // only add map relationships if user has opted in
+ if (this.useDynamicRelationships) {
+ bindings.put("relationships", getRelationshipsAsMap());
Review comment:
What about adding the dynamic relationships the same way as REL_SUCCESS and
REL_FAILURE? We wouldn't need an extra map if we could just
`session.transfer(flowFile, REL_TEST)`, and it would be more consistent with
the usage of the existing two relationships. You could put the code below into
an `else` clause for `if(this.useDynamicRelationships)`, that way you add a
REL_XYZ binding in either case, but it's either set to the Relationship `XYZ`
or the PropertyDescriptor `XYZ` depending on the setting of "Use Dynamic
Relationships"?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services