public interface Processor extends ConfigurableComponent
Processor objects operate on FlowFile objects where the processors are linked together via relationships forming a directed graph structure.
The validity of a processor once established is considered safe until a configuration property of that processor is changed. Even if the property change is itself valid it still brings the validity of the processor as a whole into question. Therefore changing a processor as a whole must be reverified. Also, changing any configuration property of a processor can also imply that its supported relationships have changed.
Each Processor object is a single node in a flow graph. The same processor object on a graph may be called concurrently to update its configuration state and to perform 'onTrigger' actions. The framework also provides numerous hooks via annotations that subclasses can use to control the lifecycle of a given processor instance.
Processor objects are expected to be thread-safe and must have a public default no-args constructor to facilitate the java service loader mechanism.
Modifier and Type | Method and Description |
---|---|
Set<Relationship> |
getRelationships() |
void |
initialize(ProcessorInitializationContext context)
Provides the processor with access to objects that may be of use
throughout the life of the Processor
|
void |
onTrigger(ProcessContext context,
ProcessSessionFactory sessionFactory)
The method called when this processor is triggered to operate by the
controller.
|
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
void initialize(ProcessorInitializationContext context)
context
- of initializationSet<Relationship> getRelationships()
void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
The method called when this processor is triggered to operate by the
controller. In the absence of the TriggerSerially
annotation,
this method may be called concurrently from different threads.
When this method is called depends on how this processor is
configured within a controller to be triggered (timing or event
based).
context
- provides access to convenience methods for obtaining
property values, delaying the scheduling of the processor, provides
access to Controller Services, etc.sessionFactory
- provides access to a ProcessSession
, which
can be used for accessing FlowFiles, etc.ProcessException
- if processing did not complete normally though
indicates the problem is an understood potential outcome of processing.
The controller/caller will handle these exceptions gracefully such as
logging, etc.. If another type of exception is allowed to propagate the
controller may no longer trigger this processor to operate, as this would
indicate a probable coding defect.Copyright © 2022 Apache NiFi Project. All rights reserved.