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

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

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

    https://github.com/apache/nifi/pull/2443#discussion_r170043364
  
    --- Diff: 
nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/GetMongo.java
 ---
    @@ -226,6 +242,11 @@ private ObjectWriter getObjectWriter(ObjectMapper 
mapper, String ppSetting) {
     
         @Override
         public void onTrigger(final ProcessContext context, final 
ProcessSession session) throws ProcessException {
    +        FlowFile input = session.get();
    +        if (!context.hasIncomingConnection() && 
(context.getProperty(QUERY) == null)) {
    +            throw new RuntimeException("Without an incoming connection, 
the Query property must be set.");
    --- End diff --
    
    I just realized that this block to check for an incoming connection and the 
Query property will get executed on each onTrigger. I believe it should be done 
during setup (with an OnScheduled method), check ExecuteSQL for an example. 
Otherwise this processor can generate an exception on each execution, and if 
the Run Schedule is zero seconds...


> Make GetMongo able to use flowfiles for queries
> -----------------------------------------------
>
>                 Key: NIFI-4827
>                 URL: https://issues.apache.org/jira/browse/NIFI-4827
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Mike Thomsen
>            Assignee: Mike Thomsen
>            Priority: Minor
>
> GetMongo should be able to retrieve a valid query from the flowfile content 
> or allow the incoming flowfile to provide attributes to power EL statements 
> in the Query configuration field. Allowing the body to be used would allow 
> GetMongo to be used in a much more generic way.



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

Reply via email to