This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-27180-kinesis-closed-shard-fail in repository https://gitbox.apache.org/repos/asf/camel.git
commit be87de0e1a9e81f9c46899d4d782ce79a9f90dcd Author: Claus Ibsen <[email protected]> AuthorDate: Tue Nov 24 19:33:57 2026 +0100 CAMEL-27180: camel-aws2-kinesis - shardClosed=fail reports a closed shard once and goes on with the other shards After a split or a merge, the closed parent shard stays in the shard list for the retention period of the stream. With shardClosed=fail, every poll after the parent was read to its end threw an IllegalStateException out of the parallel stream over the shards, while the child shards were still read by the other tasks: a WARN with a stack trace on every poll, the record count of the poll lost, forceConsumerAsReady() skipped, and the next poll could start while shard tasks of the failed poll were still running. With shardClosed=fail the consumer now hands a ReachedClosedStatusException to its exception handler once per closed shard (so bridgeErrorHandler works) and then skips the shard like silent. The reported shards are cleared when the consumer stops. With shardId set the shard is reported once, after which the consumer has nothing more to read. Each shard task of the parallel stream now catches its own failure; the poll fails with the exception of the shard only after all shard tasks finished, with the failures of other shards added as suppressed. The shardClosed option description names the right exception and describes ignore, silent and fail with and without shardId. Upgrade guide entry added. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/catalog/components/aws2-kinesis.json | 4 +- .../camel/component/aws2/kinesis/aws2-kinesis.json | 4 +- .../aws2/kinesis/Kinesis2Configuration.java | 15 +- .../component/aws2/kinesis/Kinesis2Consumer.java | 41 +++- .../aws2/kinesis/ReachedClosedStatusException.java | 1 + ...sConsumerClosedShardWithFailMultiShardTest.java | 219 +++++++++++++++++++++ .../KinesisConsumerClosedShardWithFailTest.java | 93 ++++++++- .../component/aws2/kinesis/dst/KinesisWorld.java | 4 +- .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 20 ++ .../dsl/Aws2KinesisComponentBuilderFactory.java | 19 +- .../dsl/Kinesis2EndpointBuilderFactory.java | 38 ++-- 11 files changed, 417 insertions(+), 41 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kinesis.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kinesis.json index 2dac068272c6..8eecd810360e 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kinesis.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kinesis.json @@ -34,7 +34,7 @@ "maxResultsPerRequest": { "index": 7, "kind": "property", "displayName": "Max Results Per Request", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Maximum number of records fetched from each shard in each poll: the [...] "messageTimestamp": { "index": 8, "kind": "property", "displayName": "Message Timestamp", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The message timestamp to start polling from. Required if iteratorType is set to AT_TIME [...] "sequenceNumber": { "index": 9, "kind": "property", "displayName": "Sequence Number", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The sequence number to start polling from. Required if iteratorType is set to AFTER_SEQUENC [...] - "shardClosed": { "index": 10, "kind": "property", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configura [...] + "shardClosed": { "index": 10, "kind": "property", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configura [...] "shardId": { "index": 11, "kind": "property", "displayName": "Shard Id", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Defines which shardId in the Kinesis stream to get records from" }, "kclStopCheckpointOnFailure": { "index": 12, "kind": "property", "displayName": "Kcl Stop Checkpoint On Failure", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "If we want to use a KCL Cons [...] "shardMonitorInterval": { "index": 13, "kind": "property", "displayName": "Shard Monitor Interval", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10000, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The interval in milliseconds to wait between [...] @@ -89,7 +89,7 @@ "messageTimestamp": { "index": 7, "kind": "parameter", "displayName": "Message Timestamp", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The message timestamp to start polling from. Required if iteratorType is set to AT_TIM [...] "sendEmptyMessageWhenIdle": { "index": 8, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "sequenceNumber": { "index": 9, "kind": "parameter", "displayName": "Sequence Number", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The sequence number to start polling from. Required if iteratorType is set to AFTER_SEQUEN [...] - "shardClosed": { "index": 10, "kind": "parameter", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configur [...] + "shardClosed": { "index": 10, "kind": "parameter", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configur [...] "shardId": { "index": 11, "kind": "parameter", "displayName": "Shard Id", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Defines which shardId in the Kinesis stream to get records from" }, "bridgeErrorHandler": { "index": 12, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] "exceptionHandler": { "index": 13, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...] diff --git a/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json b/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json index 2dac068272c6..8eecd810360e 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json +++ b/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/org/apache/camel/component/aws2/kinesis/aws2-kinesis.json @@ -34,7 +34,7 @@ "maxResultsPerRequest": { "index": 7, "kind": "property", "displayName": "Max Results Per Request", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Maximum number of records fetched from each shard in each poll: the [...] "messageTimestamp": { "index": 8, "kind": "property", "displayName": "Message Timestamp", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The message timestamp to start polling from. Required if iteratorType is set to AT_TIME [...] "sequenceNumber": { "index": 9, "kind": "property", "displayName": "Sequence Number", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The sequence number to start polling from. Required if iteratorType is set to AFTER_SEQUENC [...] - "shardClosed": { "index": 10, "kind": "property", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configura [...] + "shardClosed": { "index": 10, "kind": "property", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configura [...] "shardId": { "index": 11, "kind": "property", "displayName": "Shard Id", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Defines which shardId in the Kinesis stream to get records from" }, "kclStopCheckpointOnFailure": { "index": 12, "kind": "property", "displayName": "Kcl Stop Checkpoint On Failure", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "If we want to use a KCL Cons [...] "shardMonitorInterval": { "index": 13, "kind": "property", "displayName": "Shard Monitor Interval", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10000, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The interval in milliseconds to wait between [...] @@ -89,7 +89,7 @@ "messageTimestamp": { "index": 7, "kind": "parameter", "displayName": "Message Timestamp", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The message timestamp to start polling from. Required if iteratorType is set to AT_TIM [...] "sendEmptyMessageWhenIdle": { "index": 8, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "sequenceNumber": { "index": 9, "kind": "parameter", "displayName": "Sequence Number", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "The sequence number to start polling from. Required if iteratorType is set to AFTER_SEQUEN [...] - "shardClosed": { "index": 10, "kind": "parameter", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configur [...] + "shardClosed": { "index": 10, "kind": "parameter", "displayName": "Shard Closed", "group": "consumer", "label": "consumer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum", "enum": [ "ignore", "fail", "silent" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ignore", "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configur [...] "shardId": { "index": 11, "kind": "parameter", "displayName": "Shard Id", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kinesis.Kinesis2Configuration", "configurationField": "configuration", "description": "Defines which shardId in the Kinesis stream to get records from" }, "bridgeErrorHandler": { "index": 12, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] "exceptionHandler": { "index": 13, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...] diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java index b5322d000d32..9eed37ac9805 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Configuration.java @@ -66,10 +66,17 @@ public class Kinesis2Configuration implements Cloneable, AwsCommonConfiguration description = "The message timestamp to start polling from. Required if iteratorType is set to AT_TIMESTAMP") private String messageTimestamp = ""; @UriParam(label = "consumer", defaultValue = "ignore", - description = "Define what will be the behavior in case of shard closed. Possible value are ignore, silent and fail." - + " In case of ignore a WARN message will be logged once and the consumer will not process new messages until restarted," - + "in case of silent there will be no logging and the consumer will not process new messages until restarted," - + "in case of fail a ReachedClosedStateException will be thrown") + description = "Define what the consumer does when a shard it reads is closed, after it read all the records of" + + " the shard. A split or a merge of shards closes the parent shards, which stay listed for the" + + " retention period of the stream. Possible values are ignore, silent and fail." + + " With ignore a WARN message is logged once and the shard is skipped," + + " with silent the shard is skipped without logging," + + " with fail a ReachedClosedStatusException is reported once to the exception handler of the" + + " consumer (logged as a WARN, or routed to the error handler of the route with" + + " bridgeErrorHandler=true) and the shard is then skipped." + + " Without shardId the consumer goes on with the other shards of the stream, which include the" + + " child shards of the closed shard. With shardId the consumer reads only that shard, so it" + + " has no more messages to read once the shard is closed.") private Kinesis2ShardClosedStrategyEnum shardClosed = Kinesis2ShardClosedStrategyEnum.ignore; @UriParam(label = "proxy", enums = "HTTP,HTTPS", defaultValue = "HTTPS", description = "To define a proxy protocol when instantiating the Kinesis client") diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Consumer.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Consumer.java index bd4a44cd0cc5..8cc08b824b11 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Consumer.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Consumer.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Queue; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -77,6 +78,9 @@ public class Kinesis2Consumer extends ScheduledBatchPollingConsumer implements R // Written concurrently from poll()'s parallelStream over the shard list, so both must be thread-safe. private final Map<String, String> currentShardIterators = new ConcurrentHashMap<>(); private final Set<String> warnLogged = ConcurrentHashMap.newKeySet(); + // The closed shards reported to the exception handler with shardClosed=fail: each one once while the consumer runs + // (cleared when it stops), as a closed shard stays listed for the retention period of the stream + private final Set<String> closedShardsReported = ConcurrentHashMap.newKeySet(); // The sequence number of the last record routed from each shard: the position of a new shard iterator when the // cached one has expired. Like the cached iterators it is not cleared in doStop, and a route that is stopped and // started gets a new consumer. @@ -141,9 +145,28 @@ public class Kinesis2Consumer extends ScheduledBatchPollingConsumer implements R fetchAndPrepareRecordsForCamel(shard, connection, processedExchangeCount); } else { + // Each shard catches its own failure: forEach returns when the first task throws, while the tasks of the + // other shards still read and route, and the next poll could start before they are done. The poll fails + // only once all the shards of the list have been read. + Queue<RuntimeException> failures = new ConcurrentLinkedQueue<>(); getCurrentShardList() .parallelStream() - .forEach(shard -> fetchAndPrepareRecordsForCamel(shard, connection, processedExchangeCount)); + .forEach(shard -> { + try { + fetchAndPrepareRecordsForCamel(shard, connection, processedExchangeCount); + } catch (RuntimeException e) { + failures.add(e); + } + }); + RuntimeException failure = failures.poll(); + if (failure != null) { + for (RuntimeException other : failures) { + if (other != failure) { + failure.addSuppressed(other); + } + } + throw failure; + } } // okay we have some response from aws so lets mark the consumer as ready @@ -358,11 +381,16 @@ public class Kinesis2Consumer extends ScheduledBatchPollingConsumer implements R case silent: break; case fail: - LOG.info("The shard with id={} on stream {} reached CLOSE status", - shardId, getEndpoint().getConfiguration().getStreamName()); - throw new IllegalStateException( - new ReachedClosedStatusException( - getEndpoint().getConfiguration().getStreamName(), shardId)); + // reported once and then skipped, like silent: a closed shard stays in the shard list for the + // retention period of the stream, and the consumer goes on with the other shards (the child shards of a + // split or a merge) + if (closedShardsReported.add(shardId)) { + String streamName = getEndpoint().getConfiguration().getStreamName(); + getExceptionHandler().handleException( + "The shard with id=" + shardId + " on stream " + streamName + " reached CLOSE status", + new ReachedClosedStatusException(streamName, shardId)); + } + break; default: throw new IllegalArgumentException("Unsupported shard closed strategy"); } @@ -497,6 +525,7 @@ public class Kinesis2Consumer extends ScheduledBatchPollingConsumer implements R getEndpoint().getCamelContext().getExecutorServiceManager().shutdown(this.shardMonitorExecutor); this.shardMonitorExecutor = null; } + closedShardsReported.clear(); super.doStop(); } diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/ReachedClosedStatusException.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/ReachedClosedStatusException.java index 691993a758ae..a78eb1775f70 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/ReachedClosedStatusException.java +++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/ReachedClosedStatusException.java @@ -24,6 +24,7 @@ public class ReachedClosedStatusException extends Exception { private final String shardId; public ReachedClosedStatusException(String streamName, String shardId) { + super("The shard " + shardId + " of the stream " + streamName + " is closed"); this.streamName = streamName; this.shardId = shardId; } diff --git a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailMultiShardTest.java b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailMultiShardTest.java new file mode 100644 index 000000000000..1caec7523b7d --- /dev/null +++ b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailMultiShardTest.java @@ -0,0 +1,219 @@ +/* + * 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.camel.component.aws2.kinesis; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.spi.ExceptionHandler; +import org.apache.camel.support.AsyncProcessorSupport; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import software.amazon.awssdk.core.SdkBytes; +import software.amazon.awssdk.services.kinesis.KinesisClient; +import software.amazon.awssdk.services.kinesis.model.GetRecordsRequest; +import software.amazon.awssdk.services.kinesis.model.GetRecordsResponse; +import software.amazon.awssdk.services.kinesis.model.GetShardIteratorRequest; +import software.amazon.awssdk.services.kinesis.model.GetShardIteratorResponse; +import software.amazon.awssdk.services.kinesis.model.ListShardsRequest; +import software.amazon.awssdk.services.kinesis.model.ListShardsResponse; +import software.amazon.awssdk.services.kinesis.model.ProvisionedThroughputExceededException; +import software.amazon.awssdk.services.kinesis.model.Record; +import software.amazon.awssdk.services.kinesis.model.Shard; +import software.amazon.awssdk.services.kinesis.model.ShardIteratorType; + +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +/** + * shardClosed=fail on a stream that was resharded: the closed parent shard stays in the shard list next to its child + * shards. The closed shard is reported once to the exception handler of the consumer, and the polls go on reading the + * child shards. + */ +class KinesisConsumerClosedShardWithFailMultiShardTest { + + private final CamelContext context = new DefaultCamelContext(); + private final List<String> routed = new CopyOnWriteArrayList<>(); + private final List<Throwable> handled = new CopyOnWriteArrayList<>(); + + // set by a test to make GetRecords of child-2 fail, after it released the latch + private volatile boolean child2Fails; + private final CountDownLatch child2Failed = new CountDownLatch(1); + private final ProvisionedThroughputExceededException child2Failure + = ProvisionedThroughputExceededException.builder().message("Rate exceeded for shard child-2").build(); + + private Kinesis2Consumer consumer; + + @AfterEach + void stop() { + if (consumer != null) { + consumer.stop(); + } + context.stop(); + } + + @BeforeEach + void startConsumer() { + // an earlier split: the parent is closed, and its records and those of its two child shards are still readable + List<Shard> shards = List.of( + Shard.builder().shardId("parent").build(), + Shard.builder().shardId("child-1").parentShardId("parent").build(), + Shard.builder().shardId("child-2").parentShardId("parent").build()); + + KinesisClient client = Mockito.mock(KinesisClient.class); + when(client.listShards(any(ListShardsRequest.class))) + .thenReturn(ListShardsResponse.builder().shards(shards).build()); + when(client.getShardIterator(any(GetShardIteratorRequest.class))) + .thenAnswer(inv -> GetShardIteratorResponse.builder() + .shardIterator("iterator-" + inv.<GetShardIteratorRequest> getArgument(0).shardId()).build()); + when(client.getRecords(any(GetRecordsRequest.class))) + .thenAnswer(inv -> getRecords(inv.getArgument(0))); + + Kinesis2Component component = new Kinesis2Component(context); + component.start(); + + Kinesis2Configuration configuration = new Kinesis2Configuration(); + configuration.setAmazonKinesisClient(client); + configuration.setIteratorType(ShardIteratorType.TRIM_HORIZON); + configuration.setShardClosed(Kinesis2ShardClosedStrategyEnum.fail); + configuration.setStreamName("stream"); + configuration.setShardMonitorInterval(50); + + Kinesis2Endpoint endpoint = new Kinesis2Endpoint("aws2-kinesis:stream", configuration, component); + endpoint.start(); + consumer = new Kinesis2Consumer(endpoint, new AsyncProcessorSupport() { + @Override + public boolean process(Exchange exchange, AsyncCallback callback) { + routed.add(exchange.getMessage().getBody(String.class)); + callback.done(true); + return true; + } + }); + consumer.setConnection(component.getConnection()); + consumer.setExceptionHandler(new RecordingExceptionHandler()); + // the test calls poll() + consumer.setStartScheduler(false); + consumer.start(); + await().atMost(20, TimeUnit.SECONDS).until(() -> consumer.getCurrentShardList().size() == 3); + } + + private GetRecordsResponse getRecords(GetRecordsRequest request) throws InterruptedException { + String iterator = request.shardIterator(); + switch (iterator) { + case "iterator-parent": + // the last records of the parent: no next iterator, the shard is closed + return GetRecordsResponse.builder().records(record("parent-a"), record("parent-b")) + .nextShardIterator(null).build(); + case "iterator-child-1": + if (child2Fails) { + // still reading when the read of child-2 has failed (at most 5 seconds when the shards are read + // one after the other on one thread) + child2Failed.await(5, TimeUnit.SECONDS); + } + return GetRecordsResponse.builder().records(record("child-1")).nextShardIterator(iterator).build(); + case "iterator-child-2": + if (child2Fails) { + child2Failed.countDown(); + throw child2Failure; + } + return GetRecordsResponse.builder().records(record("child-2")).nextShardIterator(iterator).build(); + default: + throw new IllegalArgumentException("Unknown iterator " + iterator); + } + } + + private static Record record(String body) { + return Record.builder().sequenceNumber("1").data(SdkBytes.fromString(body, StandardCharsets.UTF_8)).build(); + } + + @Test + void closedParentShardIsReportedOnceAndTheChildShardsAreRead() throws Exception { + assertEquals(4, consumer.poll(), "the last records of the parent and a record of each child"); + assertTrue(handled.isEmpty(), "the parent is not closed yet"); + assertTrue(consumer.isShardClosed("parent")); + + // the parent stays in the shard list: later polls do not fail, and go on with the child shards + assertEquals(2, consumer.poll()); + assertEquals(2, consumer.poll()); + assertEquals(2, consumer.poll()); + + assertEquals(1, handled.size(), "the closed shard is reported once"); + ReachedClosedStatusException e = assertInstanceOf(ReachedClosedStatusException.class, handled.get(0)); + assertEquals("parent", e.getShardId()); + assertEquals("stream", e.getStreamName()); + + List<String> sorted = new ArrayList<>(routed); + Collections.sort(sorted); + assertEquals(List.of("child-1", "child-1", "child-1", "child-1", "child-2", "child-2", "child-2", "child-2", + "parent-a", "parent-b"), sorted); + } + + @Test + void failedShardFailsThePollAfterTheOtherShardsAreRead() throws Exception { + assertEquals(4, consumer.poll()); + + child2Fails = true; + Exception e = assertThrows(Exception.class, consumer::poll); + + assertSame(child2Failure, e, "the failure of the shard, not wrapped by the parallel stream"); + // when poll() fails, the other shard of the poll has been read and routed + List<String> sorted = new ArrayList<>(routed); + Collections.sort(sorted); + assertEquals(List.of("child-1", "child-1", "child-2", "parent-a", "parent-b"), sorted); + // the closed parent is reported, and is not the failure of the poll + assertEquals(1, handled.size()); + assertInstanceOf(ReachedClosedStatusException.class, handled.get(0)); + + child2Fails = false; + assertEquals(2, consumer.poll(), "the next poll reads both child shards again"); + assertEquals(1, handled.size()); + } + + private final class RecordingExceptionHandler implements ExceptionHandler { + @Override + public void handleException(Throwable exception) { + handled.add(exception); + } + + @Override + public void handleException(String message, Throwable exception) { + handled.add(exception); + } + + @Override + public void handleException(String message, Exchange exchange, Throwable exception) { + handled.add(exception); + } + } +} diff --git a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java index b9e4cebded58..bc7b961297e4 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java +++ b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java @@ -17,11 +17,15 @@ package org.apache.camel.component.aws2.kinesis; import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; import org.apache.camel.AsyncProcessor; import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.spi.ExceptionHandler; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -41,12 +45,12 @@ import software.amazon.awssdk.services.kinesis.model.Shard; import software.amazon.awssdk.services.kinesis.model.ShardIteratorType; import static org.awaitility.Awaitility.await; +import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -61,6 +65,8 @@ public class KinesisConsumerClosedShardWithFailTest { private final CamelContext context = new DefaultCamelContext(); private final Kinesis2Component component = new Kinesis2Component(context); + private final List<Throwable> handled = new CopyOnWriteArrayList<>(); + private Kinesis2Consumer underTest; @AfterEach @@ -100,17 +106,18 @@ public class KinesisConsumerClosedShardWithFailTest { endpoint.start(); underTest = new Kinesis2Consumer(endpoint, processor); underTest.setConnection(component.getConnection()); + underTest.setExceptionHandler(new RecordingExceptionHandler()); + // the test calls poll() + underTest.setStartScheduler(false); underTest.start(); await().atMost(10, TimeUnit.SECONDS) .until(() -> !(underTest.getCurrentShardList().isEmpty())); } @Test - public void itObtainsAShardIteratorOnFirstPoll() { - assertDoesNotThrow(underTest::poll); - assertThrows(IllegalStateException.class, () -> { - underTest.poll(); - }); + public void itObtainsAShardIteratorOnFirstPoll() throws Exception { + underTest.poll(); // reads the shard to its end + underTest.poll(); // the shard is now closed: reported to the exception handler, the poll does not fail final ArgumentCaptor<GetShardIteratorRequest> getShardIteratorReqCap = ArgumentCaptor.forClass(GetShardIteratorRequest.class); @@ -124,5 +131,77 @@ public class KinesisConsumerClosedShardWithFailTest { verify(kinesisClient, atLeastOnce()).listShards(getListShardsCap.capture()); assertThat(getListShardsCap.getValue().streamName(), is("streamName")); + + assertReportedOnce(); + } + + @Test + public void closedShardIsReportedOnceAndThenSkipped() throws Exception { + assertThat(underTest.poll(), is(0)); // reads the shard to its end + assertThat(underTest.isShardClosed("shardId"), is(true)); + assertThat(handled.isEmpty(), is(true)); + + // the closed shard stays in the shard list: later polls skip it, and report it only once + assertThat(underTest.poll(), is(0)); + assertThat(underTest.poll(), is(0)); + assertThat(underTest.poll(), is(0)); + + assertReportedOnce(); + verify(kinesisClient, times(1)).getRecords(any(GetRecordsRequest.class)); + } + + @Test + public void closedShardIsReportedOnceAndThenSkippedWithShardId() throws Exception { + underTest.getEndpoint().getConfiguration().setShardId("shardId"); + + assertThat(underTest.poll(), is(0)); // reads the shard to its end + assertThat(handled.isEmpty(), is(true)); + + // with shardId the consumer has nothing more to read once the shard is closed + assertThat(underTest.poll(), is(0)); + assertThat(underTest.poll(), is(0)); + assertThat(underTest.poll(), is(0)); + + assertReportedOnce(); + verify(kinesisClient, times(1)).getRecords(any(GetRecordsRequest.class)); + } + + @Test + public void closedShardIsReportedAgainAfterRestart() throws Exception { + underTest.poll(); + underTest.poll(); + assertReportedOnce(); + + underTest.stop(); + underTest.start(); + underTest.poll(); + underTest.poll(); + + assertThat(handled.size(), is(2)); + } + + private void assertReportedOnce() { + assertThat(handled.size(), is(1)); + assertThat(handled.get(0), instanceOf(ReachedClosedStatusException.class)); + ReachedClosedStatusException e = (ReachedClosedStatusException) handled.get(0); + assertThat(e.getShardId(), is("shardId")); + assertThat(e.getStreamName(), is("streamName")); + } + + private final class RecordingExceptionHandler implements ExceptionHandler { + @Override + public void handleException(Throwable exception) { + handled.add(exception); + } + + @Override + public void handleException(String message, Throwable exception) { + handled.add(exception); + } + + @Override + public void handleException(String message, Exchange exchange, Throwable exception) { + handled.add(exception); + } } } diff --git a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/dst/KinesisWorld.java b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/dst/KinesisWorld.java index 96912997aa71..999f20ccdd3f 100644 --- a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/dst/KinesisWorld.java +++ b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/dst/KinesisWorld.java @@ -52,8 +52,8 @@ import org.apache.camel.test.dst.Invariants; * <p> * The seed picks the iterator type (TRIM_HORIZON or LATEST), whether the route checkpoints with the resumable EIP and * KinesisResumeStrategy (the resume cache outlives the consumer, so a restarted route resumes from it), the number of - * shards, maxResultsPerRequest, the poll delay, the shard monitor interval and shardClosed (ignore or silent; fail ends - * the consumption of the stream by design). + * shards, maxResultsPerRequest, the poll delay, the shard monitor interval and shardClosed (ignore or silent; fail + * skips a closed shard the same way, and in addition reports it once to the exception handler of the consumer). * <p> * A route restart creates a new consumer, which this world counts as an epoch. With the one-stack model, a graceful * stop or suspend cannot see a poll that blocks below it finish, and the shutdown strategy waits for a poll in progress diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index b4fbea392414..141a734a0a99 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -6944,6 +6944,26 @@ To keep the previous behaviour, set `maxResultsPerRequest=1`. See the xref:components::aws2-kinesis-component.adoc[AWS Kinesis component] for how `maxResultsPerRequest`, `delay` and `greedy` relate to the Kinesis read quotas of a shard. +=== camel-aws2-kinesis - shardClosed=fail reports a closed shard once + +With `shardClosed=fail`, the consumer now reports a closed shard once: it hands a `ReachedClosedStatusException` to +the exception handler of the consumer (logged as a WARN, or routed to the error handler of the route with +`bridgeErrorHandler=true`), and then skips the shard, as with `silent`. The poll does not fail. + +Before, every poll failed with an `IllegalStateException` once a closed shard had been read to its end, for as long as +the shard was listed (a closed shard stays in the shard list for the retention period of the stream, 24 hours by +default). Without `shardId` the consumer read the child shards of a split or a merge all the same, so it did not stop: +it logged a WARN with a stack trace on every poll, and its health check reported the failing polls. + +With `shardId` set, the consumer reads only that shard, so once the shard is closed it reports it once and then has +nothing more to read, where before every poll failed. A route that should react to the closed shard (for example by +stopping) can set `bridgeErrorHandler=true` and handle the `ReachedClosedStatusException` in its error handler. + +When the consumer reads all the shards (no `shardId`) and the read of a shard fails, the poll now fails only after the +other shards of the poll have been read and routed, with the exception of that shard (the failures of other shards +are added as suppressed exceptions). Before, the poll failed as soon as one shard failed, with the exception wrapped +by the parallel stream, while the other shards were still being read. + === camel-graphql - the credentials are only sent to the authority of httpUri The `accessToken` (with its `jwtAuthorizationType`) is now added to a request only when the request goes to the diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java index 9e2b7ffb4952..be51af545bcc 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2KinesisComponentBuilderFactory.java @@ -234,12 +234,19 @@ public interface Aws2KinesisComponentBuilderFactory { /** - * Define what will be the behavior in case of shard closed. Possible - * value are ignore, silent and fail. In case of ignore a WARN message - * will be logged once and the consumer will not process new messages - * until restarted,in case of silent there will be no logging and the - * consumer will not process new messages until restarted,in case of - * fail a ReachedClosedStateException will be thrown. + * Define what the consumer does when a shard it reads is closed, after + * it read all the records of the shard. A split or a merge of shards + * closes the parent shards, which stay listed for the retention period + * of the stream. Possible values are ignore, silent and fail. With + * ignore a WARN message is logged once and the shard is skipped, with + * silent the shard is skipped without logging, with fail a + * ReachedClosedStatusException is reported once to the exception + * handler of the consumer (logged as a WARN, or routed to the error + * handler of the route with bridgeErrorHandler=true) and the shard is + * then skipped. Without shardId the consumer goes on with the other + * shards of the stream, which include the child shards of the closed + * shard. With shardId the consumer reads only that shard, so it has no + * more messages to read once the shard is closed. * * The option is a: * <code>org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum</code> type. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java index b2e16dd84e0f..5b055ed369a3 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Kinesis2EndpointBuilderFactory.java @@ -266,12 +266,19 @@ public interface Kinesis2EndpointBuilderFactory { return this; } /** - * Define what will be the behavior in case of shard closed. Possible - * value are ignore, silent and fail. In case of ignore a WARN message - * will be logged once and the consumer will not process new messages - * until restarted,in case of silent there will be no logging and the - * consumer will not process new messages until restarted,in case of - * fail a ReachedClosedStateException will be thrown. + * Define what the consumer does when a shard it reads is closed, after + * it read all the records of the shard. A split or a merge of shards + * closes the parent shards, which stay listed for the retention period + * of the stream. Possible values are ignore, silent and fail. With + * ignore a WARN message is logged once and the shard is skipped, with + * silent the shard is skipped without logging, with fail a + * ReachedClosedStatusException is reported once to the exception + * handler of the consumer (logged as a WARN, or routed to the error + * handler of the route with bridgeErrorHandler=true) and the shard is + * then skipped. Without shardId the consumer goes on with the other + * shards of the stream, which include the child shards of the closed + * shard. With shardId the consumer reads only that shard, so it has no + * more messages to read once the shard is closed. * * The option is a: * <code>org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum</code> type. @@ -287,12 +294,19 @@ public interface Kinesis2EndpointBuilderFactory { return this; } /** - * Define what will be the behavior in case of shard closed. Possible - * value are ignore, silent and fail. In case of ignore a WARN message - * will be logged once and the consumer will not process new messages - * until restarted,in case of silent there will be no logging and the - * consumer will not process new messages until restarted,in case of - * fail a ReachedClosedStateException will be thrown. + * Define what the consumer does when a shard it reads is closed, after + * it read all the records of the shard. A split or a merge of shards + * closes the parent shards, which stay listed for the retention period + * of the stream. Possible values are ignore, silent and fail. With + * ignore a WARN message is logged once and the shard is skipped, with + * silent the shard is skipped without logging, with fail a + * ReachedClosedStatusException is reported once to the exception + * handler of the consumer (logged as a WARN, or routed to the error + * handler of the route with bridgeErrorHandler=true) and the shard is + * then skipped. Without shardId the consumer goes on with the other + * shards of the stream, which include the child shards of the closed + * shard. With shardId the consumer reads only that shard, so it has no + * more messages to read once the shard is closed. * * The option will be converted to a * <code>org.apache.camel.component.aws2.kinesis.Kinesis2ShardClosedStrategyEnum</code> type.
