Class LookupRecord
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.LookupRecord
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SideEffectFree
@SupportsBatching
@InputRequirement(INPUT_REQUIRED)
@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")
@Tags({"lookup","enrichment","route","record","csv","json","avro","database","db","logs","convert","filter"})
@CapabilityDescription("Extracts one or more fields from a Record and looks up a value for those fields in a LookupService. If a result is returned by the LookupService, that result is optionally added to the Record. In this case, the processor functions as an Enrichment processor. Regardless, the Record is then routed to either the \'matched\' relationship or \'unmatched\' relationship (if the \'Routing Strategy\' property is configured to do so), indicating whether or not a result was returned by the LookupService, allowing the processor to also function as a Routing processor. The \"coordinates\" to use for looking up a value in the Lookup Service are defined by adding a user-defined property. Each property that is added will have an entry added to a Map, where the name of the property becomes the Map Key and the value returned by the RecordPath becomes the value for that key. If multiple values are returned by the RecordPath, then the Record will be routed to the \'unmatched\' relationship (or \'success\', depending on the \'Routing Strategy\' property\'s configuration). If one or more fields match the Result RecordPath, all fields that match will be updated. If there is no match in the configured LookupService, then no fields will be updated. I.e., it will not overwrite an existing value in the Record with a null value. Please note, however, that if the results returned by the LookupService are not accounted for in your schema (specifically, the schema that is configured for your Record Writer) then the fields will not be written out to the FlowFile.")
@DynamicProperty(name="Value To Lookup",
value="Valid Record Path",
expressionLanguageScope=FLOWFILE_ATTRIBUTES,
description="A RecordPath that points to the field whose value will be looked up in the configured Lookup Service")
@SeeAlso(value={ConvertRecord.class,SplitRecord.class},
classNames={"org.apache.nifi.lookup.SimpleKeyValueLookupService","org.apache.nifi.lookup.maxmind.IPLookupService","org.apache.nifi.lookup.db.DatabaseRecordLookupService"})
public class LookupRecord
extends org.apache.nifi.processor.AbstractProcessor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprotected static class(package private) static enumprivate classprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate LookupService<?> private static final Set<org.apache.nifi.processor.Relationship> 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.components.PropertyDescriptorprivate final RecordPathCache(package private) static final org.apache.nifi.processor.Relationship(package private) static final org.apache.nifi.processor.Relationship(package private) static final org.apache.nifi.processor.Relationship(package private) static final org.apache.nifi.processor.Relationshipprivate Set<org.apache.nifi.processor.Relationship> (package private) static final org.apache.nifi.components.AllowableValue(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.AllowableValue(package private) static final org.apache.nifi.components.AllowableValue(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.AllowableValue(package private) static final org.apache.nifi.components.AllowableValueprivate boolean(package private) static final org.apache.nifi.components.PropertyDescriptorprivate static final Set<org.apache.nifi.processor.Relationship> private static final Set<org.apache.nifi.processor.Relationship> (package private) static final org.apache.nifi.components.AllowableValue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LookupRecord.LookupContextcreateLookupContext(org.apache.nifi.flowfile.FlowFile flowFile, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session, RecordSetWriterFactory writerFactory) private LookupRecord.ReplacementStrategycreateReplacementStrategy(org.apache.nifi.processor.ProcessContext context) protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) Set<org.apache.nifi.processor.Relationship> private Set<org.apache.nifi.processor.Relationship> getRelationships(Set<LookupRecord.MatchResult> matchResults) getSubRecords(Record record, RecordPath rootRecordPath) protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) 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
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, 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, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
recordPathCache
-
lookupService
-
ROUTE_TO_SUCCESS
static final org.apache.nifi.components.AllowableValue ROUTE_TO_SUCCESS -
ROUTE_TO_MATCHED_UNMATCHED
static final org.apache.nifi.components.AllowableValue ROUTE_TO_MATCHED_UNMATCHED -
RESULT_ENTIRE_RECORD
static final org.apache.nifi.components.AllowableValue RESULT_ENTIRE_RECORD -
RESULT_RECORD_FIELDS
static final org.apache.nifi.components.AllowableValue RESULT_RECORD_FIELDS -
USE_PROPERTY
static final org.apache.nifi.components.AllowableValue USE_PROPERTY -
REPLACE_EXISTING_VALUES
static final org.apache.nifi.components.AllowableValue REPLACE_EXISTING_VALUES -
RECORD_READER
static final org.apache.nifi.components.PropertyDescriptor RECORD_READER -
RECORD_WRITER
static final org.apache.nifi.components.PropertyDescriptor RECORD_WRITER -
LOOKUP_SERVICE
static final org.apache.nifi.components.PropertyDescriptor LOOKUP_SERVICE -
ROOT_RECORD_PATH
static final org.apache.nifi.components.PropertyDescriptor ROOT_RECORD_PATH -
RESULT_CONTENTS
static final org.apache.nifi.components.PropertyDescriptor RESULT_CONTENTS -
ROUTING_STRATEGY
static final org.apache.nifi.components.PropertyDescriptor ROUTING_STRATEGY -
REPLACEMENT_STRATEGY
static final org.apache.nifi.components.PropertyDescriptor REPLACEMENT_STRATEGY -
RESULT_RECORD_PATH
static final org.apache.nifi.components.PropertyDescriptor RESULT_RECORD_PATH -
CACHE_SIZE
static final org.apache.nifi.components.PropertyDescriptor CACHE_SIZE -
PROPERTY_DESCRIPTORS
-
REL_MATCHED
static final org.apache.nifi.processor.Relationship REL_MATCHED -
REL_UNMATCHED
static final org.apache.nifi.processor.Relationship REL_UNMATCHED -
REL_SUCCESS
static final org.apache.nifi.processor.Relationship REL_SUCCESS -
REL_FAILURE
static final org.apache.nifi.processor.Relationship REL_FAILURE -
MATCHED_COLLECTION
-
UNMATCHED_COLLECTION
-
SUCCESS_COLLECTION
-
relationships
-
routeToMatchedUnmatched
private volatile boolean routeToMatchedUnmatched
-
-
Constructor Details
-
LookupRecord
public LookupRecord()
-
-
Method Details
-
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) -
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
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
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
onPropertyModified
public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) - Specified by:
onPropertyModifiedin interfaceorg.apache.nifi.components.ConfigurableComponent- Overrides:
onPropertyModifiedin classorg.apache.nifi.components.AbstractConfigurableComponent
-
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
-
getSubRecords
-
getRelationships
private Set<org.apache.nifi.processor.Relationship> getRelationships(Set<LookupRecord.MatchResult> matchResults) -
createReplacementStrategy
private LookupRecord.ReplacementStrategy createReplacementStrategy(org.apache.nifi.processor.ProcessContext context) -
createLookupContext
protected LookupRecord.LookupContext createLookupContext(org.apache.nifi.flowfile.FlowFile flowFile, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session, RecordSetWriterFactory writerFactory)
-