Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/2777
  
    @MikeThomsen @ijokarumawak Hey guys, I'm sorry to chime in a bit late here. 
I don't think this is really the approach that we want to take here, though. 
What our interface provides currently is a mechanism to pass in the 
'coordinates', i.e., the location for finding the data that we want. The 
approach here takes this concepts and muddies it by providing arbitrary 
key/value pairs that don't make sense for the lookup.
    
    I would propose an alternative approach, which would be to add a new method 
to the interface that has a default implementation:
    ```
    default Optional<T> lookup(Map<String, Object> coordinates, Map<String, 
String> context) throws LookupFailureException {
        return lookup(coordinates);
    }
    ```
    Where `context` is used for the FlowFile attributes (I'm referring to it as 
`context` instead of `attributes` because there may well be a case where we 
want to provide some other value that is not specifically a FlowFile 
attribute). Here is why I am suggesting this:
    - It provides a clean interface that properly separates the data's 
coordinates from FlowFile attributes.
    - It prevents any collisions between FlowFile attribute names and 
coordinates.
    - It maintains backward compatibility, and we know that it won't change the 
behavior of existing services or processors/components using those services - 
even those that may have been implemented by others outside of the Apache realm.
    - If attributes are passed in by a Processor, those attributes will be 
ignored anyway unless the Controller Service is specifically updated to make 
use of those attributes, such as via Expression Language. In such a case, the 
Controller Service can simply be updated at that time to make use of the new 
method instead of the existing method.



---

Reply via email to