GH-210: Short-circuit Kinesis consumer for stop
Fixes https://github.com/spring-projects/spring-integration-aws/issues/210 To avoid extra cycles for tasks and locks renewal check for a closed shard just after `getShardIterator()` request in a `NEW` consumer task **Cherry-pick to `2.5.x`**
This commit is contained in:
@@ -974,6 +974,10 @@ public class KinesisMessageDrivenChannelAdapter extends MessageProducerSupport
|
||||
.amazonKinesis
|
||||
.getShardIterator(shardIteratorRequest)
|
||||
.getShardIterator();
|
||||
if (this.shardIterator == null) {
|
||||
// The shard is closed - stop consumer
|
||||
this.state = ConsumerState.STOP;
|
||||
}
|
||||
if (ConsumerState.STOP != this.state) {
|
||||
this.state = ConsumerState.CONSUME;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user