Russell,

Are you trying to execute the code in onTrigger() only if a dynamic
property has been modified? If so you could have a boolean member
variable "shouldRun" that gets set to true in onPropertyModified() and
checked/reset in onTrigger(). The scripting components do something
similar, to indicate whether the script needs to be reloaded or not.

Apologies if I'm not understanding correctly, could you share your
code as a Gist or something like that?

Thanks,
Matt

On Fri, Jan 8, 2021 at 10:34 AM Russell Bateman <r...@windofkeltia.com> wrote:
>
> The code I really want to run is sitting in onTrigger(), though I could
> move it elsewhere.
>
> Yes, I have tried
>
> *Scheduling Strategy*of Timer driven
> *Run Schedule*of 10 sec
>
> ...but the getLogger().info( "called from onTrigger()" )never reaches
> /logs/nifi-app.log/ (while the logging statement from
> onPropertyModified()does reach the log every time I change properties to
> remove old or introduce new properties).
>
>
> On 1/7/21 6:38 PM, Russell Bateman wrote:
> > (Inadequate title; didn't know what to call it.)
> >
> > I have written a processor that doesn't feature any relationships.
> >
> > It accepts dynamically properties that, in theory, when created (or
> > removed, or values added or changed), and sets data into a class
> > inside my NAR.
> >
> > I wonder, however, at what I expect of it because, while it works in
> > unit testing, it does not in practice. I can sort of guess why, but
> > I'm not sure what to do about it. Given that I can create methods to
> > be called at various opportunities by annotating thus:
> >
> >     @OnAdded
> >     @OnEnabled
> >     @OnRemoved
> >     @OnScheduled
> >     @OnUnscheduled
> >     @OnStopped
> >     @OnShutdown
> >
> > There isn't one of these annotations that says to my brain, "When a
> > dynamic property is added, changed or removed, wake up and run this
> > method." Except, of course, for onPropertyModified(). A new property
> > is duly added when created in configuration; my call to
> > getLogger.info()from onPropertyModified()shows
> >
> > 2021-01-07 18:32:51,923 INFO [NiFi Web Server-78]
> > c.windofkeltia.processor.HumanReadables
> > HumanReadables[id=afa5b637-0176-1000-78bd-a74904054649] null ->
> > |http://hospital.smarthealthit.org|Smart Health IT
> >
> > But, how do I incite some code after the fact to awaken and analyze
> > the newly added configuration then affect the
> > HumanReadableMappingsclass instance?
> >
> > (Hope I haven't explained this too badly. I am willing to attach
> > code--it's a very tiny processor.)
> >
> > Thanks
> >
> >
> >
>

Reply via email to