NiFi Developer's Guide
Also available as:
PDF
loading table of contents...

@OnScheduled

This annotation indicates that a method should be called every time the component is scheduled to run. Because ControllerServices are not scheduled, using this annotation on a ControllerService does not make sense and will not be honored. It should be used only for Processors and Reporting Tasks. If any method with this annotation throws an Exception, other methods with this annotation will not be invoked, and a notification will be presented to the user. In this case, methods annotated with @OnUnscheduled are then triggered, followed by methods with the @OnStopped annotation (during this state, if any of these methods throws an Exception, those Exceptions are ignored). The component will then yield its execution for some period of time, referred to as the "Administrative Yield Duration," which is a value that is configured in the nifi.properties file. Finally, the process will start again, until all of the methods annotated with @OnScheduled have returned without throwing any Exception. Methods with this annotation may take zero arguments or may take a single argument. If the single argument variation is used, the argument must be of type ProcessContext if the component is a Processor or ConfigurationContext if the component is a ReportingTask.