You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Steve Youtsey <st...@clearability.com> on 2015/04/08 22:58:33 UTC

Reporting Tasks and onEnabled

It appears that Reporting Tasks are not able to obtain a reference to a
Controller Service from within a method annotated with onEnabled. Is this
as designed?

Also, can a Controller Service obtain a reference to another Controller
Service from an onEnabled annotated method?

Thanks
Steve

Re: Reporting Tasks and onEnabled

Posted by Steven Youtsey <sy...@verizon.net>.
I am using 0.0.2-incubating, and passing in the ConfigurationContext. It's not that I have an issue with the API (and good to know it's changing in 0.1.0), it's that the provided reference to the service is null. From your comments, this is probably because it is a Reporting Task and I was using OnEnabled. I'll switch to OnScheduled. 

Thanks much!Steve
 


     On Thursday, April 9, 2015 3:23 PM, Matt Gilman <ma...@gmail.com> wrote:
   

 Steve,

Not sure which version your referring to.

In 0.0.2-incubating, the JavaDocs state that onEnabled can be used on a
method with 0 or 1 argument. Using the single argument approach, the method
will be invoked with a ConfigurationContext that should be able to obtain a
reference to a ControllerService through the PropertyValue. I'm pretty sure
the annotations were refactored in this version in preparation for
0.1.0-incubating where the ControllerServices and ReportingTasks are
configurable in the UI so make sure your not referencing a deprecated
annotation.

In 0.1.0-incubating-SNAPSHOT, the JavaDocs state that the onEnabled
annotation is only applicable for ControllerServices. Processors and
ReportingTasks should use the onScheduled annotation. Both of these
annotations (onEnabled for ControllerServices and onScheduled for
Processors/ReportingTasks) can be used on a method with 0 or 1 argument.
Using the single argument approach, the method will be invoked with a
ConfigurationContext argument. From it, the component should be able to
obtain a reference to a ControllerService through the PropertyValue.

Matt

On Wed, Apr 8, 2015 at 4:58 PM, Steve Youtsey <steveyoutsey@clearability.com
> wrote:

> It appears that Reporting Tasks are not able to obtain a reference to a
> Controller Service from within a method annotated with onEnabled. Is this
> as designed?
>
> Also, can a Controller Service obtain a reference to another Controller
> Service from an onEnabled annotated method?
>
> Thanks
> Steve
>


   

Re: Reporting Tasks and onEnabled

Posted by Matt Gilman <ma...@gmail.com>.
Steve,

Not sure which version your referring to.

In 0.0.2-incubating, the JavaDocs state that onEnabled can be used on a
method with 0 or 1 argument. Using the single argument approach, the method
will be invoked with a ConfigurationContext that should be able to obtain a
reference to a ControllerService through the PropertyValue. I'm pretty sure
the annotations were refactored in this version in preparation for
0.1.0-incubating where the ControllerServices and ReportingTasks are
configurable in the UI so make sure your not referencing a deprecated
annotation.

In 0.1.0-incubating-SNAPSHOT, the JavaDocs state that the onEnabled
annotation is only applicable for ControllerServices. Processors and
ReportingTasks should use the onScheduled annotation. Both of these
annotations (onEnabled for ControllerServices and onScheduled for
Processors/ReportingTasks) can be used on a method with 0 or 1 argument.
Using the single argument approach, the method will be invoked with a
ConfigurationContext argument. From it, the component should be able to
obtain a reference to a ControllerService through the PropertyValue.

Matt

On Wed, Apr 8, 2015 at 4:58 PM, Steve Youtsey <steveyoutsey@clearability.com
> wrote:

> It appears that Reporting Tasks are not able to obtain a reference to a
> Controller Service from within a method annotated with onEnabled. Is this
> as designed?
>
> Also, can a Controller Service obtain a reference to another Controller
> Service from an onEnabled annotated method?
>
> Thanks
> Steve
>