You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Dominique De Vito <dd...@gmail.com> on 2018/03/26 13:55:20 UTC

Processor example with dynamically fetched values for attributs

Hi,

I try to define a Processor such as for a given attribut:

* the possible values are dynamically fetched from a REST WS (from time to
time)

* the UI offers to select one of these values from a drop-down list.

Is there some processor implementing such a pattern? If so, then, I may
take it as an example.

If there is no such processor, does someone know if the Processor I
envision is doable with current NiFi version?

Thanks.

Regards,
Dominique

Re: Processor example with dynamically fetched values for attributs

Posted by Bryan Bende <bb...@gmail.com>.
Hello,

Every time a user opens the configuration window for a processor, the
NiFi UI is retrieving all of the information about the processor from
the server, which would eventually call the
getSupportedPropertyDescriptors() method.

It can't be refreshed while you are in the configuration window, but
it is refreshed every time it is opened.

Here is an example of what I was trying to describe:

https://gist.github.com/bbende/a190baf21573c36f99eba459ae84c0c3

I have not actually run the above example, it is just a theoretical
approach to how you could handle it.

Thanks,

Bryan


On Thu, Mar 29, 2018 at 11:51 AM, Dominique De Vito <dd...@gmail.com> wrote:
> Hi,
>
>> This pattern isn't really supported at the moment...
>
> OK, I see: nothing in "PropertyDescriptor" Java class to call an external
> service (e.g WS) to get accepted values.
>
> So, in case of need to call an external service (e.g WS), this should be
> done per processor - in the getSupportedPropertyDescriptors() method
>
> Yes, no mechanism on the server-side for refrehing list. OK.
>
> And a more "important" problem too (= less easier to fix AFAIU), I see
> nothing - on UI side - to refresh the list => no "refresh" button for
> example and it's logic so far ;-)
>
> -- do I am correct to assume UI and NiFi server are in link with WebSocket ?
>
>    If so, then refresh may go through this link ("push" mode).
>
> -- otherwise, the UI would have to call the NiFi server for refresh, from
> time to time.
>
> Thanks.
>
> Regards,
> Dominique
>
>
>
> 2018-03-26 17:59 GMT+02:00 Bryan Bende <bb...@gmail.com>:
>>
>> Hello,
>>
>> This pattern isn't really supported at the moment...
>>
>> You would not want to make calls to external services when opening the
>> config window of a processor because then you risk blocking on an
>> network call if the system is down or unresponsive, or just risking
>> taking a really long time to load.
>>
>> You could possibly attempt to start some background thread when the
>> processor starts that would periodically fetch values to a list in the
>> processor, and then every time getPropertyDescriptors was called you
>> would create a new PropertDescriptor for the given property using the
>> latest list, but there is nothing built in to help with this.
>>
>> It also doesn't work well for documentation which is auto-generated
>> when the application starts and would have no way of knowing what the
>> allowable values are for the property.
>>
>> -Bryan
>>
>> On Mon, Mar 26, 2018 at 9:55 AM, Dominique De Vito <dd...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I try to define a Processor such as for a given attribut:
>> >
>> > * the possible values are dynamically fetched from a REST WS (from time
>> > to
>> > time)
>> >
>> > * the UI offers to select one of these values from a drop-down list.
>> >
>> > Is there some processor implementing such a pattern? If so, then, I may
>> > take
>> > it as an example.
>> >
>> > If there is no such processor, does someone know if the Processor I
>> > envision
>> > is doable with current NiFi version?
>> >
>> > Thanks.
>> >
>> > Regards,
>> > Dominique
>> >
>
>

Re: Processor example with dynamically fetched values for attributs

Posted by Dominique De Vito <dd...@gmail.com>.
Hi,

> This pattern isn't really supported at the moment...

OK, I see: nothing in "PropertyDescriptor" Java class to call an external
service (e.g WS) to get accepted values.

So, in case of need to call an external service (e.g WS), this should be
done per processor - in the getSupportedPropertyDescriptors() method

Yes, no mechanism on the server-side for refrehing list. OK.

And a more "important" problem too (= less easier to fix AFAIU), I see
nothing - on UI side - to refresh the list => no "refresh" button for
example and it's logic so far ;-)

-- do I am correct to assume UI and NiFi server are in link with WebSocket
?

   If so, then refresh may go through this link ("push" mode).

-- otherwise, the UI would have to call the NiFi server for refresh, from
time to time.

Thanks.

Regards,
Dominique



2018-03-26 17:59 GMT+02:00 Bryan Bende <bb...@gmail.com>:

> Hello,
>
> This pattern isn't really supported at the moment...
>
> You would not want to make calls to external services when opening the
> config window of a processor because then you risk blocking on an
> network call if the system is down or unresponsive, or just risking
> taking a really long time to load.
>
> You could possibly attempt to start some background thread when the
> processor starts that would periodically fetch values to a list in the
> processor, and then every time getPropertyDescriptors was called you
> would create a new PropertDescriptor for the given property using the
> latest list, but there is nothing built in to help with this.
>
> It also doesn't work well for documentation which is auto-generated
> when the application starts and would have no way of knowing what the
> allowable values are for the property.
>
> -Bryan
>
> On Mon, Mar 26, 2018 at 9:55 AM, Dominique De Vito <dd...@gmail.com>
> wrote:
> > Hi,
> >
> > I try to define a Processor such as for a given attribut:
> >
> > * the possible values are dynamically fetched from a REST WS (from time
> to
> > time)
> >
> > * the UI offers to select one of these values from a drop-down list.
> >
> > Is there some processor implementing such a pattern? If so, then, I may
> take
> > it as an example.
> >
> > If there is no such processor, does someone know if the Processor I
> envision
> > is doable with current NiFi version?
> >
> > Thanks.
> >
> > Regards,
> > Dominique
> >
>

Re: Processor example with dynamically fetched values for attributs

Posted by Bryan Bende <bb...@gmail.com>.
Hello,

This pattern isn't really supported at the moment...

You would not want to make calls to external services when opening the
config window of a processor because then you risk blocking on an
network call if the system is down or unresponsive, or just risking
taking a really long time to load.

You could possibly attempt to start some background thread when the
processor starts that would periodically fetch values to a list in the
processor, and then every time getPropertyDescriptors was called you
would create a new PropertDescriptor for the given property using the
latest list, but there is nothing built in to help with this.

It also doesn't work well for documentation which is auto-generated
when the application starts and would have no way of knowing what the
allowable values are for the property.

-Bryan

On Mon, Mar 26, 2018 at 9:55 AM, Dominique De Vito <dd...@gmail.com> wrote:
> Hi,
>
> I try to define a Processor such as for a given attribut:
>
> * the possible values are dynamically fetched from a REST WS (from time to
> time)
>
> * the UI offers to select one of these values from a drop-down list.
>
> Is there some processor implementing such a pattern? If so, then, I may take
> it as an example.
>
> If there is no such processor, does someone know if the Processor I envision
> is doable with current NiFi version?
>
> Thanks.
>
> Regards,
> Dominique
>