Change the TerminalResult to return an empty GetRecordsResult
Changes the TerminalResult to provide an empty GetRecordsResult, which components downstream depend on.
This commit is contained in:
parent
f8425d9283
commit
cc2e92001a
1 changed files with 6 additions and 8 deletions
|
|
@ -68,25 +68,23 @@ class KinesisDataFetcher {
|
|||
throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization.");
|
||||
}
|
||||
|
||||
DataFetcherResult response;
|
||||
if (nextIterator != null) {
|
||||
try {
|
||||
response = new AdvancingResult(kinesisProxy.get(nextIterator, maxRecords));
|
||||
return new AdvancingResult(kinesisProxy.get(nextIterator, maxRecords));
|
||||
} catch (ResourceNotFoundException e) {
|
||||
LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId);
|
||||
response = TERMINAL_RESULT;
|
||||
return TERMINAL_RESULT;
|
||||
}
|
||||
} else {
|
||||
response = TERMINAL_RESULT;
|
||||
return TERMINAL_RESULT;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
final DataFetcherResult TERMINAL_RESULT = new DataFetcherResult() {
|
||||
@Override
|
||||
public GetRecordsResult getResult() {
|
||||
return null;
|
||||
return new GetRecordsResult().withMillisBehindLatest(null).withRecords(Collections.emptyList())
|
||||
.withNextShardIterator(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue