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

Exposing Processor's Relationships

In order for a Processor to transfer a FlowFile to a new destination for follow-on processing, the Processor must first be able to expose to the Framework all of the Relationships that it currently supports. This allows users of the application to connect Processors to one another by creating Connections between Processors and assigning the appropriate Relationships to those Connections.

A Processor exposes the valid set of Relationships by overriding the getRelationships method. This method takes no arguments and returns a Set of Relationship objects. For most Processors, this Set will be static, but other Processors will generate the Set dynamically, based on user configuration. For those Processors for which the Set is static, it is advisable to create an immutable Set in the Processor's constructor or init method and return that value, rather than dynamically generating the Set. This pattern lends itself to cleaner code and better performance.