@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=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(value={"lookup","enrichment","route","record","csv","json","avro","database","db","logs","convert","filter"}) @CapabilityDescription(value="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 AbstractRouteRecord<Tuple<Map<String,RecordPath>,RecordPath>>
RECORD_READER, RECORD_WRITER, REL_FAILURE, REL_ORIGINAL
Constructor and Description |
---|
LookupRecord() |
onTrigger
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
private volatile RecordPathCache recordPathCache
private volatile LookupService<?> lookupService
static final AllowableValue ROUTE_TO_SUCCESS
static final AllowableValue ROUTE_TO_MATCHED_UNMATCHED
static final AllowableValue RESULT_ENTIRE_RECORD
static final AllowableValue RESULT_RECORD_FIELDS
static final AllowableValue USE_PROPERTY
static final AllowableValue REPLACE_EXISTING_VALUES
static final PropertyDescriptor LOOKUP_SERVICE
static final PropertyDescriptor RESULT_RECORD_PATH
static final PropertyDescriptor RESULT_CONTENTS
static final PropertyDescriptor ROUTING_STRATEGY
static final PropertyDescriptor REPLACEMENT_STRATEGY
static final Relationship REL_MATCHED
static final Relationship REL_UNMATCHED
static final Relationship REL_SUCCESS
private static final Set<Relationship> MATCHED_COLLECTION
private static final Set<Relationship> UNMATCHED_COLLECTION
private static final Set<Relationship> SUCCESS_COLLECTION
private volatile Set<Relationship> relationships
private volatile boolean routeToMatchedUnmatched
@OnScheduled public void onScheduled(ProcessContext context)
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractRouteRecord<Tuple<Map<String,RecordPath>,RecordPath>>
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractRouteRecord<Tuple<Map<String,RecordPath>,RecordPath>>
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
protected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate
in class AbstractConfigurableComponent
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
protected Set<Relationship> route(Record record, RecordSchema writeSchema, FlowFile flowFile, ProcessContext context, Tuple<Map<String,RecordPath>,RecordPath> flowFileContext)
route
in class AbstractRouteRecord<Tuple<Map<String,RecordPath>,RecordPath>>
private Set<Relationship> doInPlaceReplacement(Record record, FlowFile flowFile, ProcessContext context, Tuple<Map<String,RecordPath>,RecordPath> flowFileContext)
private Set<Relationship> doResultPathReplacement(Record record, FlowFile flowFile, ProcessContext context, Tuple<Map<String,RecordPath>,RecordPath> flowFileContext)
protected boolean isRouteOriginal()
isRouteOriginal
in class AbstractRouteRecord<Tuple<Map<String,RecordPath>,RecordPath>>
protected Tuple<Map<String,RecordPath>,RecordPath> getFlowFileContext(FlowFile flowFile, ProcessContext context)
getFlowFileContext
in class AbstractRouteRecord<Tuple<Map<String,RecordPath>,RecordPath>>
Copyright © 2020 Apache NiFi Project. All rights reserved.