[ 
https://issues.apache.org/jira/browse/NIFI-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16501078#comment-16501078
 ] 

ASF GitHub Bot commented on NIFI-5214:
--------------------------------------

Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2723#discussion_r192917579
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/RestLookupService.java
 ---
    @@ -277,6 +280,20 @@ private void setProxy(OkHttpClient.Builder builder) {
             }
         }
     
    +    protected String determineEndpoint(Map<String, Object> coordinates) {
    +        if (coordinates.containsKey(ENDPOINT_KEY) && 
coordinates.containsKey(ENDPOINT_TEMPLATE_KEY)) {
    +            Map<String, String> converted = coordinates.entrySet().stream()
    +                .collect(Collectors.toMap(
    +                    e -> e.getKey(),
    +                    e -> e.getValue().toString()
    +                ));
    +            final PreparedQuery query = 
Query.prepare((String)coordinates.get(ENDPOINT_KEY));
    --- End diff --
    
    @MikeThomsen Thanks for adding this! This gets closer to what I was 
imagined. Excuse me if I was not clear enough, but from a user's stand point, 
I'd like to configure this ENDPOINT_KEY value at the RestLookupService property 
rather than passing it via coordinates.
    
    Because, I think people would use one RestLookupService to lookup some 
endpoints (can be more than 1) of a particular Web service API. If they need to 
deal with different Web services, e.g. Twitter, Facebook and Salesforce ...etc 
they would use 3 RestLookupService, and each one can have the endpoint template 
defined.
    
    Further more, if we implemented like that, we can cache the PreparedQuery 
instance without parsing the EL every time. Also, no need to have 
`ENDPOINT_TEMPLATE_KEY` coordinate to tell if it contains EL or not because the 
PreparedQuery returns the original String if it does not contains EL.
    
    How do you think?


> Add a REST lookup service
> -------------------------
>
>                 Key: NIFI-5214
>                 URL: https://issues.apache.org/jira/browse/NIFI-5214
>             Project: Apache NiFi
>          Issue Type: New Feature
>            Reporter: Mike Thomsen
>            Assignee: Mike Thomsen
>            Priority: Major
>
> * Should have reader API support
>  * Should be able to drill down through complex XML and JSON responses to a 
> nested record.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to