You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Manish Gupta 8 <mg...@sapient.com> on 2016/09/14 18:45:15 UTC

OnTrigger - FlowFile is Null

Hi,

In one of our custom processor, I forgot to mention the following check, and the error started showing up randomly.

        if (flowFile == null) {
            return;
        }


I am just curious to know, in what situation would onTrigger will get called if there is no FlowFile?

Regards,
Manish


RE: OnTrigger - FlowFile is Null

Posted by Manish Gupta 8 <mg...@sapient.com>.
Apologies for the typo. I meant *Mark.


Regards,
Manish
Cell: +1 646-744-7606<tel:%2B1%20646-744-7606>
Email: mgupta50@sapient.com<ma...@sapient.com>

From: Manish Gupta 8
Sent: Wednesday, September 14, 2016 2:55 PM
To: users@nifi.apache.org
Subject: RE: OnTrigger - FlowFile is Null

Thanks Matt. This is very helpful. In my case also, it's the 3rd scenario. I remember, this error started showing up only when I had increased the concurrent tasks to greater than 1 sometime earlier today.

Regards,
Manish
Cell: +1 646-744-7606<tel:%2B1%20646-744-7606>
Email: mgupta50@sapient.com<ma...@sapient.com>

From: Mark Payne [mailto:markap14@hotmail.com]
Sent: Wednesday, September 14, 2016 2:50 PM
To: users@nifi.apache.org<ma...@nifi.apache.org>
Subject: Re: OnTrigger - FlowFile is Null

Manish,

This happens for a few reasons:

* Processor has no incoming connections (is a source processor)
* Processor has @ScheduleWhenEmpty annotation
* Processor has more than 1 concurrent task

The main reason is the third one above. If you have multiple concurrent tasks, Thread 1 can determine that there is 1
FlowFile queued. Thread 2 then determines that there is 1 FlowFile queued. Both threads call
onTrigger(). Thread 1 gets the FlowFIle, and Thread 2 gets null.

Does this help?

Thanks
-Mark


On Sep 14, 2016, at 2:45 PM, Manish Gupta 8 <mg...@sapient.com>> wrote:

Hi,

In one of our custom processor, I forgot to mention the following check, and the error started showing up randomly.

        if (flowFile == null) {
            return;
        }


I am just curious to know, in what situation would onTrigger will get called if there is no FlowFile?

Regards,
Manish


RE: OnTrigger - FlowFile is Null

Posted by Manish Gupta 8 <mg...@sapient.com>.
Thanks Matt. This is very helpful. In my case also, it's the 3rd scenario. I remember, this error started showing up only when I had increased the concurrent tasks to greater than 1 sometime earlier today.

Regards,
Manish
Cell: +1 646-744-7606<tel:%2B1%20646-744-7606>
Email: mgupta50@sapient.com<ma...@sapient.com>

From: Mark Payne [mailto:markap14@hotmail.com]
Sent: Wednesday, September 14, 2016 2:50 PM
To: users@nifi.apache.org
Subject: Re: OnTrigger - FlowFile is Null

Manish,

This happens for a few reasons:

* Processor has no incoming connections (is a source processor)
* Processor has @ScheduleWhenEmpty annotation
* Processor has more than 1 concurrent task

The main reason is the third one above. If you have multiple concurrent tasks, Thread 1 can determine that there is 1
FlowFile queued. Thread 2 then determines that there is 1 FlowFile queued. Both threads call
onTrigger(). Thread 1 gets the FlowFIle, and Thread 2 gets null.

Does this help?

Thanks
-Mark


On Sep 14, 2016, at 2:45 PM, Manish Gupta 8 <mg...@sapient.com>> wrote:

Hi,

In one of our custom processor, I forgot to mention the following check, and the error started showing up randomly.

        if (flowFile == null) {
            return;
        }


I am just curious to know, in what situation would onTrigger will get called if there is no FlowFile?

Regards,
Manish


Re: OnTrigger - FlowFile is Null

Posted by Mark Payne <ma...@hotmail.com>.
Manish,

This happens for a few reasons:

* Processor has no incoming connections (is a source processor)
* Processor has @ScheduleWhenEmpty annotation
* Processor has more than 1 concurrent task

The main reason is the third one above. If you have multiple concurrent tasks, Thread 1 can determine that there is 1
FlowFile queued. Thread 2 then determines that there is 1 FlowFile queued. Both threads call
onTrigger(). Thread 1 gets the FlowFIle, and Thread 2 gets null.

Does this help?

Thanks
-Mark


> On Sep 14, 2016, at 2:45 PM, Manish Gupta 8 <mg...@sapient.com> wrote:
> 
> Hi,
>  
> In one of our custom processor, I forgot to mention the following check, and the error started showing up randomly.
>  
>         if (flowFile == null) {
>             return;
>         }
>  
> I am just curious to know, in what situation would onTrigger will get called if there is no FlowFile?
>  
> Regards,
> Manish