[ 
https://issues.apache.org/jira/browse/NIFI-14817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vijaya Gorla updated NIFI-14817:
--------------------------------
    Description: 
When GetElasticsearch processor has an incoming connection, and the document id 
is an expression, this results in expression evaluating to null when the 
processor runs without a flow file. This can happen in a clustered NiFi setup 
when there are more nodes in the cluster than the number of flow files in the 
queue.

For example, when there is a flow file in the queue, the processor's onTrigger 
is invoked on all nodes (even the ones that don't have a flow file) resulting 
in some nodes throwing an error.

 This can be handled by short-circuiting the onTrigger method like many core 
processors do
{code:java}
        FlowFile input = null;
        if (context.hasIncomingConnection()) {
            input = session.get();

            // If we have no FlowFile, and all incoming connections are 
self-loops then we can continue on.
            // However, if we have no FlowFile and we have connections coming 
from other Processors, then
            // we know that we should run only if we have a FlowFile.
            if (input == null && context.hasNonLoopConnection()) {
                return;
            }
        }
{code}
 

  was:
When GetElasticsearch processor has an incoming connection, and the document id 
is an expression, this results in expression evaluating to null when the 
processor runs without a flow file. This can happen in a clustered NiFi setup 
where there are more nodes in the cluster than the number of flow files in the 
queue. 

When there is a flow file in the queue, the processor's onTrigger is invoked on 
all nodes (even the ones that don't have a flow file) resulting in some nodes 
throwing error.

 This can be handled by short-circuiting the onTrigger method like many stock 
processors do
{code:java}
        FlowFile input = null;
        if (context.hasIncomingConnection()) {
            input = session.get();

            // If we have no FlowFile, and all incoming connections are 
self-loops then we can continue on.
            // However, if we have no FlowFile and we have connections coming 
from other Processors, then
            // we know that we should run only if we have a FlowFile.
            if (input == null && context.hasNonLoopConnection()) {
                return;
            }
        }
{code}
 


> GetElasticsearch throws an error when it is triggered without a flow file
> -------------------------------------------------------------------------
>
>                 Key: NIFI-14817
>                 URL: https://issues.apache.org/jira/browse/NIFI-14817
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>            Reporter: Vijaya Gorla
>            Priority: Major
>              Labels: elasticsearch
>
> When GetElasticsearch processor has an incoming connection, and the document 
> id is an expression, this results in expression evaluating to null when the 
> processor runs without a flow file. This can happen in a clustered NiFi setup 
> when there are more nodes in the cluster than the number of flow files in the 
> queue.
> For example, when there is a flow file in the queue, the processor's 
> onTrigger is invoked on all nodes (even the ones that don't have a flow file) 
> resulting in some nodes throwing an error.
>  This can be handled by short-circuiting the onTrigger method like many core 
> processors do
> {code:java}
>         FlowFile input = null;
>         if (context.hasIncomingConnection()) {
>             input = session.get();
>             // If we have no FlowFile, and all incoming connections are 
> self-loops then we can continue on.
>             // However, if we have no FlowFile and we have connections coming 
> from other Processors, then
>             // we know that we should run only if we have a FlowFile.
>             if (input == null && context.hasNonLoopConnection()) {
>                 return;
>             }
>         }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to