Class GenerateRecord
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.GenerateRecord
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SupportsBatching
@Tags({"test","random","generate","fake"})
@InputRequirement(INPUT_FORBIDDEN)
@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")
@CapabilityDescription("This processor creates FlowFiles with records having random value for the specified fields. GenerateRecord is useful for testing, configuration, and simulation. It uses either user-defined properties to define a record schema or a provided schema and generates the specified number of records using random data for the fields in the schema.")
@DynamicProperties(@DynamicProperty(name="Field name in generated record",value="Faker category for generated record values",description="Custom properties define the generated record schema using configured field names and value data types in absence of the Schema Text property"))
public class GenerateRecord
extends org.apache.nifi.processor.AbstractProcessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate net.datafaker.Fakerprivate static final org.apache.nifi.components.AllowableValue[]private static final Stringprivate static final Stringprivate static final Stringprivate static final String(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate static final List<org.apache.nifi.components.PropertyDescriptor> (package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.processor.Relationship(package private) static final Set<org.apache.nifi.processor.Relationship> (package private) static final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Stringprotected RecordSchemagenerateRecordSchema(Map<String, String> fields, boolean nullable) private ObjectgenerateValueFromRecordField(RecordField recordField, net.datafaker.Faker faker, int nullPercentage) getFields(org.apache.nifi.processor.ProcessContext context) Set<org.apache.nifi.processor.Relationship> protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> voidonScheduled(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
fakerDatatypeValues
private static final org.apache.nifi.components.AllowableValue[] fakerDatatypeValues -
KEY1
- See Also:
-
KEY2
- See Also:
-
KEY3
- See Also:
-
KEY4
- See Also:
-
RECORD_WRITER
static final org.apache.nifi.components.PropertyDescriptor RECORD_WRITER -
NUM_RECORDS
static final org.apache.nifi.components.PropertyDescriptor NUM_RECORDS -
NULLABLE_FIELDS
static final org.apache.nifi.components.PropertyDescriptor NULLABLE_FIELDS -
NULL_PERCENTAGE
static final org.apache.nifi.components.PropertyDescriptor NULL_PERCENTAGE -
SCHEMA_TEXT
static final org.apache.nifi.components.PropertyDescriptor SCHEMA_TEXT -
PROPERTY_DESCRIPTORS
-
REL_SUCCESS
static final org.apache.nifi.processor.Relationship REL_SUCCESS -
RELATIONSHIPS
-
faker
private volatile net.datafaker.Faker faker
-
-
Constructor Details
-
GenerateRecord
public GenerateRecord()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
getFields
-
generateValueFromRecordField
private Object generateValueFromRecordField(RecordField recordField, net.datafaker.Faker faker, int nullPercentage) -
generateRandomString
-
generateRecordSchema
-