in src/main/java/com/amazonaws/services/dynamodbv2/streamsadapter/AmazonDynamoDBStreamsAdapterClient.java [441:467]
public GetRecordsResult getRecords(GetRecordsRequest getRecordsRequest) {
if (getRecordsRequest.getLimit() != null && getRecordsRequest.getLimit() > GET_RECORDS_LIMIT) {
getRecordsRequest.setLimit(GET_RECORDS_LIMIT);
}
GetRecordsRequestAdapter requestAdapter = new GetRecordsRequestAdapter(getRecordsRequest);
requestCache.addEntry(getRecordsRequest, requestAdapter);
try {
com.amazonaws.services.dynamodbv2.model.GetRecordsResult result = internalClient.getRecords(requestAdapter);
List<Record> records = result.getRecords();
if (records != null && !records.isEmpty()) {
final int lastIndex = result.getRecords().size() - 1;
final StreamRecord lastStreamRecord = result.getRecords().get(lastIndex).getDynamodb();
final double lastApproximateCreationTimestamp = lastStreamRecord.getApproximateCreationDateTime().getTime();
final double millisBehindLatest = Math.max(System.currentTimeMillis() - lastApproximateCreationTimestamp, 0);
IMetricsScope scope = MetricsHelper.getMetricsScope();
scope.addData(MILLIS_BEHIND_LATEST_METRIC, millisBehindLatest, StandardUnit.Milliseconds, MetricsLevel.SUMMARY);
}
if (result != null && result.getNextShardIterator() == null && result.getSdkResponseMetadata() != null) {
LOG.info("RequestId for getRecords which resulted in ShardEnd: " + result.getSdkResponseMetadata().getRequestId());
}
return new GetRecordsResultAdapter(result, generateRecordBytes);
} catch (AmazonServiceException e) {
throw AmazonServiceExceptionTransformer.transformDynamoDBStreamsToKinesisGetRecords(e, skipRecordsBehavior);
}
}