@SupportsBatching @Tags(value={"test","random","generate","fake"}) @InputRequirement(value=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(value="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(value=@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 AbstractProcessor
| Modifier and Type | Field and Description |
|---|---|
private com.github.javafaker.Faker |
faker |
private static AllowableValue[] |
fakerDatatypeValues |
private static String |
KEY1 |
private static String |
KEY2 |
private static String |
KEY3 |
private static String |
KEY4 |
(package private) static PropertyDescriptor |
NULL_PERCENTAGE |
(package private) static PropertyDescriptor |
NULLABLE_FIELDS |
(package private) static PropertyDescriptor |
NUM_RECORDS |
(package private) static PropertyDescriptor |
RECORD_WRITER |
(package private) static Relationship |
REL_SUCCESS |
(package private) static Set<Relationship> |
RELATIONSHIPS |
(package private) static PropertyDescriptor |
SCHEMA_TEXT |
| Constructor and Description |
|---|
GenerateRecord() |
| Modifier and Type | Method and Description |
|---|---|
private String |
generateRandomString() |
protected RecordSchema |
generateRecordSchema(Map<String,String> fields,
boolean nullable) |
private Object |
generateValueFromRecordField(RecordField recordField,
com.github.javafaker.Faker faker,
int nullPercentage) |
protected Map<String,String> |
getFields(ProcessContext context) |
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
void |
onScheduled(ProcessContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static final AllowableValue[] fakerDatatypeValues
private static final String KEY1
private static final String KEY2
private static final String KEY3
private static final String KEY4
static final PropertyDescriptor RECORD_WRITER
static final PropertyDescriptor NUM_RECORDS
static final PropertyDescriptor NULLABLE_FIELDS
static final PropertyDescriptor NULL_PERCENTAGE
static final PropertyDescriptor SCHEMA_TEXT
static final Relationship REL_SUCCESS
static final Set<Relationship> RELATIONSHIPS
private volatile com.github.javafaker.Faker faker
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessor@OnScheduled public void onScheduled(ProcessContext context)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprotected Map<String,String> getFields(ProcessContext context)
private Object generateValueFromRecordField(RecordField recordField, com.github.javafaker.Faker faker, int nullPercentage)
private String generateRandomString()
protected RecordSchema generateRecordSchema(Map<String,String> fields, boolean nullable)
Copyright © 2023 Apache NiFi Project. All rights reserved.