Ryan,

The down side to that approach is that you're tying up that thread from the 
thread pool when you call sleep.

Typically, in a situation like this, where you want to 'pause' processing for a 
bit, you would call ProcessContext.yield() and then return. 
This causes the framework not to trigger that processor for some period of time 
(configurable in the Settings tab, default is 1 sec).

Does this work for you?

Thanks
-Mark


----------------------------------------
> Date: Thu, 13 Aug 2015 14:19:36 -0400
> Subject: Threading in a NiFi Processor
> From: [email protected]
> To: [email protected]
>
> I have always stayed away from doing any threading inside a NiFi processor.
>
> However, I recently came across a use-case where I'm calling a web service
> from within a custom Nifi Processor and I don't want to overwhelm the web
> service.
>
> I'd like to instrument a sleep in the onTrigger() or process() method of
> about 1 second, or a configurable amount.
>
> Is there a pattern established for Nifi Processors to accomplish this
> nicely?
>
> Thanks,
> Ryan
                                          

Reply via email to