pelaezryan commented on code in PR #245:
URL: 
https://github.com/apache/flink-connector-aws/pull/245#discussion_r3220790491


##########
flink-connector-aws/flink-connector-aws-kinesis-streams/src/main/java/org/apache/flink/connector/kinesis/source/reader/fanout/FanOutKinesisShardSubscription.java:
##########
@@ -330,8 +379,14 @@ public void onError(Throwable throwable) {
         @Override
         public void onComplete() {
             LOG.info("Subscription complete - {} ({})", shardId, consumerArn);
-            cancel();
-            activateSubscription();
+            this.subscriptionState.set(SubscriptionState.COMPLETED);
         }
     }
+
+    /** States that the {@code FanOutShardSubscriber} may be in. */
+    private enum SubscriptionState {
+        NOT_STARTED,
+        SUBSCRIBED,
+        COMPLETED

Review Comment:
   Not that I am aware of. When any exceptions occur we terminate the 
subscription (if it's not done so already):
   
   ```
           kinesis.subscribeToShard(consumerArn, shardId, startingPosition, 
responseHandler)
                   .exceptionally(
                           throwable -> {
                               // If consumer exists and is still activating, 
we want to countdown.
                               if (ExceptionUtils.findThrowable(
                                               throwable, 
ResourceInUseException.class)
                                       .isPresent()) {
                                   waitForSubscriptionLatch.countDown();
                                   return null;
                               }
                               LOG.error(
                                       "Error subscribing to shard {} with 
starting position {} for consumer {}.",
                                       shardId,
                                       startingPosition,
                                       consumerArn,
                                       throwable);
                               terminateSubscription(throwable);
                               return null;
                           });
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to