Interface ReportingTask
- All Superinterfaces:
ConfigurableComponent
- All Known Implementing Classes:
AbstractReportingTask
ReportingTask
s are discovered using Java's
ServiceLoader
mechanism. As a result, all implementations must
follow these rules:
- The implementation must implement this interface.
- The implementation must have a file named
org.apache.nifi.reporting.ReportingTask located within the jar's
META-INF/services
directory. This file contains a list of fully-qualified class names of allReportingTask
s in the jar, one-per-line. - The implementation must support a default constructor.
ReportingTasks are scheduled on a delayed interval with a single thread. Therefore, implementations are not required to be thread-safe.
ReportingTasks may choose to annotate a method with the
@OnConfigurationRestored
annotation. If this is done, that method
will be invoked after all properties have been set for the ReportingTask and
before it is scheduled to run. If the method throws an Exception, the
ReportingTask will be Administratively yielded and will not run for the
configured period of time.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Provides the Reporting Task with access to objects that may be of use throughout the life of the servicedefault boolean
isStateful
(ReportingContext context) Indicates whether this reporting task, configured with the givenReportingContext
, stores state.default void
Allows for the migration of an old property configuration to a new configuration.void
onTrigger
(ReportingContext context) This method is called on a scheduled interval to allow the Reporting Task to perform its tasks.Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
-
Method Details
-
initialize
Provides the Reporting Task with access to objects that may be of use throughout the life of the service- Parameters:
config
- of initialization context- Throws:
InitializationException
- if unable to init
-
onTrigger
This method is called on a scheduled interval to allow the Reporting Task to perform its tasks.- Parameters:
context
- reporting context
-
isStateful
Indicates whether this reporting task, configured with the givenReportingContext
, stores state.- Parameters:
context
- provides access to convenience methods for obtaining property values- Returns:
- True if this reporting task stores state
-
migrateProperties
Allows for the migration of an old property configuration to a new configuration. This allows the Reporting Task to evolve over time, as it allows properties to be renamed, removed, or reconfigured.
This method is called only when a Reporting Task is restored from a previous configuration. For example, when NiFi is restarted and the flow is restored from disk, when a previously configured flow is imported (e.g., from a JSON file that was exported or a NiFi Registry), or when a node joins a cluster and inherits a flow that has a new Reporting Task. Once called, the method will not be invoked again for this Reporting Task until NiFi is restarted.
- Parameters:
config
- the current property configuration
-