最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

spring integration - What is the effect of streamInitialSequence in case there are already checkpoints in DynamoDB? - Stack Over

programmeradmin13浏览0评论

I would like to use KinesisMessageDrivenChannelAdapter to read records from a Kinesis stream. When starting the consumer application for the very first time, I would like it to receive all records that already exist in the stream. On subsequent starts though, the application should continue reading from the latest checkpointed sequence number coming from DynamoDb.

Is my assumption correct that adapter.setStreamInitialSequence(KinesisShardOffset.trimHorizon()) provides this behaviour?

I would like to use KinesisMessageDrivenChannelAdapter to read records from a Kinesis stream. When starting the consumer application for the very first time, I would like it to receive all records that already exist in the stream. On subsequent starts though, the application should continue reading from the latest checkpointed sequence number coming from DynamoDb.

Is my assumption correct that adapter.setStreamInitialSequence(KinesisShardOffset.trimHorizon()) provides this behaviour?

Share Improve this question asked Nov 18, 2024 at 16:21 Shuffling2241Shuffling2241 272 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

That works only for new consumers in the group. If there is already a checkpoint for this consumer group and that shard, then we go like this:

        if (this.shardOffset.isReset()) {
            this.checkpointer.remove();
        }
        else {
            String checkpoint = this.checkpointer.getCheckpoint();
            if (checkpoint != null) {
                this.shardOffset.setSequenceNumber(checkpoint);
                this.shardOffset.setIteratorType(ShardIteratorType.AFTER_SEQUENCE_NUMBER);
            }
        }

So, it is going to consume from a stored checkpoint.

If you'd like to use that trimHorizon, then you call KinesisMessageDrivenChannelAdapter.resetCheckpoints().

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论