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

    Fields
    Modifier and Type
    Field
    Description
    private net.datafaker.Faker
     
    private static final org.apache.nifi.components.AllowableValue[]
     
    private static final String
     
    private static final String
     
    private static final String
     
    private 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.PropertyDescriptor
     
    private 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private String
     
    protected RecordSchema
    generateRecordSchema(Map<String,String> fields, boolean nullable)
     
    private Object
    generateValueFromRecordField(RecordField recordField, net.datafaker.Faker faker, int nullPercentage)
     
    protected Map<String,String>
    getFields(org.apache.nifi.processor.ProcessContext context)
     
    Set<org.apache.nifi.processor.Relationship>
     
    protected org.apache.nifi.components.PropertyDescriptor
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    void
    onScheduled(org.apache.nifi.processor.ProcessContext context)
     
    void
    onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
     

    Methods inherited from class org.apache.nifi.processor.AbstractProcessor

    onTrigger

    Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor

    getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue

    Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent

    customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.nifi.components.ConfigurableComponent

    getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate

    Methods inherited from interface org.apache.nifi.processor.Processor

    isStateful, migrateProperties, migrateRelationships
  • Field Details

    • fakerDatatypeValues

      private static final org.apache.nifi.components.AllowableValue[] fakerDatatypeValues
    • KEY1

      private static final String KEY1
      See Also:
    • KEY2

      private static final String KEY2
      See Also:
    • KEY3

      private static final String KEY3
      See Also:
    • KEY4

      private static final String 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

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_SUCCESS

      static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • RELATIONSHIPS

      static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • faker

      private volatile net.datafaker.Faker faker
  • Constructor Details

    • GenerateRecord

      public GenerateRecord()
  • Method Details

    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • getSupportedDynamicPropertyDescriptor

      protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
      Overrides:
      getSupportedDynamicPropertyDescriptor in class org.apache.nifi.components.AbstractConfigurableComponent
    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.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:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • getFields

      protected Map<String,String> getFields(org.apache.nifi.processor.ProcessContext context)
    • generateValueFromRecordField

      private Object generateValueFromRecordField(RecordField recordField, net.datafaker.Faker faker, int nullPercentage)
    • generateRandomString

      private String generateRandomString()
    • generateRecordSchema

      protected RecordSchema generateRecordSchema(Map<String,String> fields, boolean nullable)