ChrisSamo632 commented on a change in pull request #4822:
URL: https://github.com/apache/nifi/pull/4822#discussion_r627252972



##########
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/record/AbstractKinesisRecordProcessor.java
##########
@@ -0,0 +1,281 @@
+/*
+ * 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.aws.kinesis.stream.record;
+
+import 
com.amazonaws.services.kinesis.clientlibrary.exceptions.InvalidStateException;
+import 
com.amazonaws.services.kinesis.clientlibrary.exceptions.ShutdownException;
+import 
com.amazonaws.services.kinesis.clientlibrary.exceptions.ThrottlingException;
+import 
com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer;
+import 
com.amazonaws.services.kinesis.clientlibrary.interfaces.v2.IRecordProcessor;
+import com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShutdownReason;
+import com.amazonaws.services.kinesis.clientlibrary.types.InitializationInput;
+import com.amazonaws.services.kinesis.clientlibrary.types.ProcessRecordsInput;
+import com.amazonaws.services.kinesis.clientlibrary.types.ShutdownInput;
+import com.amazonaws.services.kinesis.model.Record;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.logging.ComponentLog;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.aws.kinesis.stream.ConsumeKinesisStream;
+import org.apache.nifi.util.StopWatch;
+
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractKinesisRecordProcessor implements 
IRecordProcessor {
+    public static final String AWS_KINESIS_SHARD_ID = "aws.kinesis.shard.id";
+
+    public static final String AWS_KINESIS_SEQUENCE_NUMBER = 
"aws.kinesis.sequence.number";
+
+    public static final String AWS_KINESIS_PARTITION_KEY = 
"aws.kinesis.partition.key";
+
+    public static final String AWS_KINESIS_APPROXIMATE_ARRIVAL_TIMESTAMP = 
"aws.kinesis.approximate.arrival.timestamp";
+
+    public static final String KINESIS_RECORD_SCHEMA_KEY = "kinesis.name";
+
+    static final Base64.Encoder BASE_64_ENCODER = Base64.getEncoder();
+
+    final ProcessSessionFactory sessionFactory;
+    final ComponentLog log;
+    final String streamName;
+    final String endpointPrefix;
+
+    final long checkpointIntervalMillis;
+    final long retryWaitMillis;
+    final int numRetries;
+    final DateTimeFormatter dateTimeFormatter;
+
+    String kinesisShardId;
+    long nextCheckpointTimeInMillis;
+
+    boolean processingRecords = false;

Review comment:
       Think I'd missed updating some of these from a previous incarnation.
   
   I thought default (package-private) would be better than `protected` because 
everything that uses these properties are within the same package and I don't 
(currently) anticipate any classes to extend this abstract class in other 
packages (without also updating `ConsumeKinesisStream` itself and also then 
they might as well add `protected` modifier here).
   
   Not `private` because the fields are used by the concrete classes (and unit 
tests)... but I was being lazy and not generating getter/setter methods, so 
I've made things `private` and added appropriate getter/setters where needed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to