[
https://issues.apache.org/jira/browse/NIFI-4188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16091119#comment-16091119
]
ASF GitHub Bot commented on NIFI-4188:
--------------------------------------
Github user jvwing commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2012#discussion_r127879683
--- Diff:
nifi-nar-bundles/nifi-rethinkdb-bundle/nifi-rethinkdb-processors/src/main/java/org/apache/nifi/processors/rethinkdb/GetRethinkDB.java
---
@@ -0,0 +1,197 @@
+/*
+ * 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.processors.rethinkdb;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+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.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+import org.apache.nifi.components.AllowableValue;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.expression.AttributeExpression.ResultType;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+
+import com.google.gson.Gson;
+
+import java.io.ByteArrayInputStream;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED)
+@EventDriven
+@Tags({"rethinkdb", "get", "read"})
+@CapabilityDescription("Processor to get a JSON document from RethinkDB
(https://www.rethinkdb.com/) using the document id. The FlowFile will contain
the retrieved document")
+@WritesAttributes({
+ @WritesAttribute(attribute = GetRethinkDB.RETHINKDB_ERROR_MESSAGE,
description = "RethinkDB error message"),
+ })
+@SeeAlso({PutRethinkDB.class})
+public class GetRethinkDB extends AbstractRethinkDBProcessor {
+
+ public static AllowableValue READ_MODE_SINGLE = new
AllowableValue("single", "Single", "Read values from memory from primary
replica (Default)");
+ public static AllowableValue READ_MODE_MAJORITY = new
AllowableValue("majority", "Majority", "Read values commited to disk on
majority of replicas");
+ public static AllowableValue READ_MODE_OUTDATED = new
AllowableValue("outdated", "Outdated", "Read values from memory from an
arbitrary replica ");
+
+ protected static final PropertyDescriptor READ_MODE = new
PropertyDescriptor.Builder()
+ .name("rethinkdb-read-mode")
+ .displayName("Read Mode")
+ .description("Read mode used for consistency")
+ .required(true)
+ .defaultValue(READ_MODE_SINGLE.getValue())
+ .allowableValues(READ_MODE_SINGLE, READ_MODE_MAJORITY,
READ_MODE_OUTDATED)
+ .expressionLanguageSupported(true)
+ .build();
+
+ public static final PropertyDescriptor RETHINKDB_DOCUMENT_ID = new
PropertyDescriptor.Builder()
+ .displayName("Document Identifier")
+ .name("rethinkdb-document-identifier")
+ .description("A FlowFile attribute, or attribute expression
used " +
+ "for determining RethinkDB key for the Flow File content")
+ .required(true)
+
.addValidator(StandardValidators.createAttributeExpressionLanguageValidator(ResultType.STRING,
true))
+ .expressionLanguageSupported(true)
+ .build();
+
+ protected String READ_MODE_KEY = "read_mode";
+
+ private static final Set<Relationship> relationships;
+ private static final List<PropertyDescriptor> propertyDescriptors;
+
+ public static final String RETHINKDB_ERROR_MESSAGE =
"rethinkdb.error.message";
--- End diff --
Should RETHINKDB_ERROR_MESSAGE be shared in AbstractRethinkDBProcessor now
that it is used by both processors?
> Create RethinkDB get processor
> ------------------------------
>
> Key: NIFI-4188
> URL: https://issues.apache.org/jira/browse/NIFI-4188
> Project: Apache NiFi
> Issue Type: New Feature
> Components: Extensions
> Affects Versions: 1.3.0
> Environment: All
> Reporter: Mans Singh
> Assignee: Mans Singh
> Priority: Minor
> Labels: document, get, rethinkdb
> Fix For: 1.4.0
>
>
> Create processor for getting documents by id from RethinkDB
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)