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
|
|
@ -67,26 +67,24 @@ class KinesisDataFetcher {
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization.");
|
throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization.");
|
||||||
}
|
}
|
||||||
|
|
||||||
DataFetcherResult response;
|
|
||||||
if (nextIterator != null) {
|
if (nextIterator != null) {
|
||||||
try {
|
try {
|
||||||
response = new AdvancingResult(kinesisProxy.get(nextIterator, maxRecords));
|
return new AdvancingResult(kinesisProxy.get(nextIterator, maxRecords));
|
||||||
} catch (ResourceNotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId);
|
LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId);
|
||||||
response = TERMINAL_RESULT;
|
return TERMINAL_RESULT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response = TERMINAL_RESULT;
|
return TERMINAL_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final DataFetcherResult TERMINAL_RESULT = new DataFetcherResult() {
|
final DataFetcherResult TERMINAL_RESULT = new DataFetcherResult() {
|
||||||
@Override
|
@Override
|
||||||
public GetRecordsResult getResult() {
|
public GetRecordsResult getResult() {
|
||||||
return null;
|
return new GetRecordsResult().withMillisBehindLatest(null).withRecords(Collections.emptyList())
|
||||||
|
.withNextShardIterator(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue