@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"record","schema","validate"}) @CapabilityDescription(value="Validates the Records of an incoming FlowFile against a given schema. All records that adhere to the schema are routed to the \"valid\" relationship while records that do not adhere to the schema are routed to the \"invalid\" relationship. It is therefore possible for a single incoming FlowFile to be split into two individual FlowFiles if some records are valid according to the schema and others are not. Any FlowFile that is routed to the \"invalid\" relationship will emit a ROUTE Provenance Event with the Details field populated to explain why records were invalid. In addition, to gain further explanation of why records were invalid, DEBUG-level logging can be enabled for the \"org.apache.nifi.processors.standard.ValidateRecord\" logger.") @WritesAttribute(attribute="mime.type",description="Sets the mime.type attribute to the MIME Type specified by the Record Writer") @WritesAttribute(attribute="record.count",description="The number of records in the FlowFile routed to a relationship") public class ValidateRecord extends AbstractProcessor
| Constructor and Description |
|---|
ValidateRecord() |
| Modifier and Type | Method and Description |
|---|---|
private void |
closeQuietly(RecordSetWriter writer) |
private void |
completeFlowFile(ProcessContext context,
ProcessSession session,
FlowFile flowFile,
RecordSetWriter writer,
Relationship relationship,
String details) |
private RecordSetWriter |
createIfNecessary(RecordSetWriter writer,
RecordSetWriterFactory factory,
ProcessSession session,
FlowFile flowFile,
RecordSchema outputSchema) |
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected RecordSchema |
getValidationSchema(ProcessContext context,
FlowFile flowFile,
RecordReader reader) |
private void |
logValidationErrors(FlowFile flowFile,
int recordCount,
SchemaValidationResult result) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatestatic final AllowableValue SCHEMA_NAME_PROPERTY
static final AllowableValue SCHEMA_TEXT_PROPERTY
static final AllowableValue READER_SCHEMA
static final PropertyDescriptor RECORD_READER
static final PropertyDescriptor RECORD_WRITER
static final PropertyDescriptor INVALID_RECORD_WRITER
static final PropertyDescriptor SCHEMA_ACCESS_STRATEGY
public static final PropertyDescriptor SCHEMA_REGISTRY
static final PropertyDescriptor SCHEMA_NAME
static final PropertyDescriptor SCHEMA_TEXT
static final PropertyDescriptor ALLOW_EXTRA_FIELDS
static final PropertyDescriptor STRICT_TYPE_CHECKING
static final PropertyDescriptor COERCE_TYPES
static final PropertyDescriptor VALIDATION_DETAILS_ATTRIBUTE_NAME
static final PropertyDescriptor MAX_VALIDATION_DETAILS_LENGTH
static final Relationship REL_VALID
static final Relationship REL_INVALID
static final Relationship REL_FAILURE
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponentpublic void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate void closeQuietly(RecordSetWriter writer)
private void completeFlowFile(ProcessContext context, ProcessSession session, FlowFile flowFile, RecordSetWriter writer, Relationship relationship, String details) throws IOException
IOExceptionprivate RecordSetWriter createIfNecessary(RecordSetWriter writer, RecordSetWriterFactory factory, ProcessSession session, FlowFile flowFile, RecordSchema outputSchema) throws SchemaNotFoundException, IOException
SchemaNotFoundExceptionIOExceptionprivate void logValidationErrors(FlowFile flowFile, int recordCount, SchemaValidationResult result)
protected RecordSchema getValidationSchema(ProcessContext context, FlowFile flowFile, RecordReader reader) throws MalformedRecordException, IOException, SchemaNotFoundException
Copyright © 2023 Apache NiFi Project. All rights reserved.