ScriptedValidateRecord

Description:

This processor provides the ability to validate records in FlowFiles using the user-provided script. The script is expected to have a record as incoming argument and return with a boolean value. Based on this result, the processor categorizes the records as "valid" or "invalid" and routes them to the respective relationship in batch. Additionally the original FlowFile will be routed to the "original" relationship or in case of unsuccessful processing, to the "failed" relationship.

Additional Details...

Tags:

record, validate, script, groovy, jython, python

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

NameDefault ValueAllowable ValuesDescription
Record ReaderController Service API:
RecordReaderFactory
Implementations: JsonPathReader
ScriptedReader
CSVReader
AvroReader
SyslogReader
XMLReader
CEFReader
JsonTreeReader
WindowsEventLogReader
ReaderLookup
Syslog5424Reader
GrokReader
ParquetReader
The Record Reader to use parsing the incoming FlowFile into Records
Record WriterController Service API:
RecordSetWriterFactory
Implementations: RecordSetWriterLookup
AvroRecordSetWriter
FreeFormTextRecordSetWriter
XMLRecordSetWriter
ScriptedRecordSetWriter
CSVRecordSetWriter
JsonRecordSetWriter
ParquetRecordSetWriter
The Record Writer to use for serializing Records after they have been transformed
Script LanguageGroovy
  • Clojure
  • ECMAScript
  • Groovy
  • lua
  • python
  • ruby
The Language to use for the script
Script BodyBody of script to execute. Only one of Script File or Script Body may be used
Script FilePath to script file to execute. Only one of Script File or Script Body may be used

This property requires exactly one file to be provided..

Supports Expression Language: true (will be evaluated using variable registry only)
Module DirectoryComma-separated list of paths to files and/or directories which contain modules required by the script.

This property expects a comma-separated list of resources. Each of the resources may be of any of the following types: directory, file.

Supports Expression Language: true (will be evaluated using variable registry only)

Relationships:

NameDescription
validFlowFile containing the valid records from the incoming FlowFile will be routed to this relationship. If there are no valid records, no FlowFile will be routed to this Relationship.
invalidFlowFile containing the invalid records from the incoming FlowFile will be routed to this relationship. If there are no invalid records, no FlowFile will be routed to this Relationship.
failureIn case of any issue during processing the incoming flow file, the incoming FlowFile will be routed to this relationship.
originalAfter successful procession, the incoming FlowFile will be transferred to this relationship. This happens regardless the FlowFiles might routed to "valid" and "invalid" relationships.

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
mime.typeSets the mime.type attribute to the MIME Type specified by the Record Writer
record.countThe number of records within the flow file.
record.error.messageThis attribute provides on failure the error message encountered by the Reader or Writer.

State management:

This component does not store state.

Restricted:

Required PermissionExplanation
execute codeProvides operator the ability to execute arbitrary code assuming all permissions that NiFi has.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.

See Also:

ScriptedTransformRecord, ScriptedFilterRecord, ScriptedPartitionRecord