nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Bean <mark.o.b...@gmail.com>
Subject Re: Static processor design
Date Sat, 09 Jan 2021 17:19:41 GMT
Russ,

If you're going to process a flowfile by a processor via ProcessSession
(even if "process" does nothing but pass the FF along, unmodified), you
still need to get it from the session and subsequently transfer it to a
relationship. My suggestion was meant to indicate you can handle multiple
flowfiles in a single OnTrigger call thereby moving as many FF's at once.
In other words, only one thread allocation to this processor will move N
flowfiles versus waiting for N allocations of a thread if only moving one
at a time. This will increase throughput and assist in your "as fast as
possible" requirement.

-Mark


On Sat, Jan 9, 2021 at 11:27 AM Russell Bateman <russ@windofkeltia.com>
wrote:

> Mark,
>
> Thanks for responding. I think my question is a little more naive than
> that on my part.
>
> I want to get those files through there as fast as possible. If I ask
> for /n/ files, how many would contribute to them getting them through
> the quickest? After all, I will do nothing at all to any except transfer
> them on and I don't care how many.
>
> I write a lot of custom processors that do specific things to flowfiles
> one at a time. This isn't one of those. I don't care what's coming
> through, I just want to get every flowfile straight through with no
> changes.
>
> Thanks.
>
> Russ
>
> On 1/9/21 9:09 AM, Mark Bean wrote:
> > Russell,
> >
> > You can use "session.get(N)" where N is an integer. This will get up to N
> > flowfiles per OnTrigger() call.
> >
> > -Mark
> >
> >
> > On Fri, Jan 8, 2021 at 5:07 PM Russell Bateman <russ@windofkeltia.com>
> > wrote:
> >
> >> Very well, I have decided to force customer flowfiles through this
> >> processor (I did check out the /Listen/* processors, but chose this
> >> easier solution). This now works. However,
> >>
> >> It brings up another question: is this the most efficient way to pass
> >> flowfiles straight through this processor (we're not processing them in
> >> any way), or is there a batching technique that's faster, etc. I want
> >> this to be straight-through, no back-pressure, throttling or influencing
> >> their passage whatsoever (because I didn't want them coming through in
> >> the first place). It should be ask if this processor weren't there.
> >>
> >> Thanks for any and all thoughts on this.
> >>
> >> public class HumanReadables extends AbstractProcessor{private boolean
> >> propertyModified = false;@Override public void onTrigger( final
> >> ProcessContext context, final ProcessSession session ) throws
> >> ProcessException{FlowFile flowfile = session.get();if( propertyModified
> >> ){propertyModified = false;// record effects of changed
> >> properties...}if( nonNull( flowfile ) )session.transfer( flowfile,
> >> SUCCESS );}...@Override public void onPropertyModified( final
> >> PropertyDescriptor descriptor, final String oldValue, final String
> >> newValue ){propertyModified = true;}
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message