[
https://issues.apache.org/jira/browse/NIFI-5829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16702282#comment-16702282
]
ASF GitHub Bot commented on NIFI-5829:
--------------------------------------
Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/3188#discussion_r237218520
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/lookup/ReaderLookup.java
---
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.lookup;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.behavior.DynamicProperty;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnDisabled;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.logging.ComponentLog;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.schema.access.SchemaNotFoundException;
+import org.apache.nifi.serialization.MalformedRecordException;
+import org.apache.nifi.serialization.RecordReader;
+import org.apache.nifi.serialization.RecordReaderFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Tags({"lookup", "parse", "record", "row", "reader"})
+@SeeAlso({RecordSetWriterLookup.class})
+@CapabilityDescription("Provides a RecordReaderFactory that can be used to
dynamically select another RecordReaderFactory. This service " +
+ "requires an attribute named 'recordreader.name' to be passed in
when asking for a record record, and will throw an exception " +
+ "if the attribute is missing. The value of 'recordreader.name'
will be used to select the RecordReaderFactory that has been " +
+ "registered with that name. This will allow multiple
RecordReaderFactory's to be defined and registered, and then selected " +
+ "dynamically at runtime by tagging flow files with the appropriate
'recordreader.name' attribute.")
+@DynamicProperty(name = "The ", value = "RecordWriterFactory property
value", expressionLanguageScope = ExpressionLanguageScope.NONE,
+ description = "")
+public class ReaderLookup extends AbstractControllerService implements
RecordReaderFactory {
--- End diff --
Now that controller services can have access to attributes, it would be
nice to add support in the documentation for `ReadsAttributes` annotations. You
don't need to do that here, just leaving it as a reminder for a future
improvement Jira :)
> Create Lookup Controller Services for RecordSetWriter and RecordReader
> ----------------------------------------------------------------------
>
> Key: NIFI-5829
> URL: https://issues.apache.org/jira/browse/NIFI-5829
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Peter Wicks
> Assignee: Peter Wicks
> Priority: Minor
>
> In the same way as the new DBCP Lookup Service, create lookup services for
> RecordSetWriter and RecordReader.
> This will help to make flows much more generic, and allow for some very
> flexible processors.
> Example: A processor like PutDatabaseRecord will be able to push to any
> database in any readable record format from a single processor by configuring
> everything through the lookup services.
> Example: ConvertRecord will be able to convert from any number of various
> input formats to a constant output format by using the RecordReader Lookup,
> and a fixed RecordSetWriter.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)