mns*_*mns 5 amazon-web-services amazon-dynamodb
我为我的发电机表设置了流。我正在按照文档中的示例程序从流中读取数据(http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.LowLevel.Walkthrough.CompleteProgram.html)。但是我有一个问题 - 当迭代分片时,似乎检查分片迭代器是否为空并不是退出循环的充分条件。我的代码进入无限循环。在示例程序中,对更改数量进行计数,并用于退出循环 -->
while (nextItr != null && numChanges > 0) {
// Use the iterator to read the data records from the shard
GetRecordsResult getRecordsResult =
streamsClient.getRecords(new GetRecordsRequest().
withShardIterator(nextItr));
List<Record> records = getRecordsResult.getRecords();
System.out.println("Getting records...");
for (Record record : records) {
System.out.println(record);
numChanges--;
}
nextItr = getRecordsResult.getNextShardIterator();
}
Run Code Online (Sandbox Code Playgroud)
但在真实环境中,我确信维护更改列表是不切实际的。设计是否意味着无限循环?为什么 shardIterator 不会变成 null?
归档时间: |
|
查看次数: |
6052 次 |
最近记录: |