com.amazonaws.services.dynamodbv2.model.GetShardIteratorRequest Java Examples

The following examples show how to use com.amazonaws.services.dynamodbv2.model.GetShardIteratorRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamoDbSourceTask.java    From kafka-connect-dynamodb with Apache License 2.0 6 votes vote down vote up
private GetShardIteratorRequest getShardIteratorRequest(
        String shardId,
        String streamArn,
        String seqNum
) {
    final GetShardIteratorRequest req = new GetShardIteratorRequest();
    req.setShardId(shardId);
    req.setStreamArn(streamArn);
    if (seqNum == null) {
        req.setShardIteratorType(ShardIteratorType.TRIM_HORIZON);
    } else {
        req.setShardIteratorType(ShardIteratorType.AFTER_SEQUENCE_NUMBER);
        req.setSequenceNumber(seqNum);
    }
    return req;
}
 
Example #2
Source File: DynamoDbSourceTask.java    From kafka-connect-dynamodb with Apache License 2.0 5 votes vote down vote up
private String shardIterator(String shardId) {
    String iterator = shardIterators.get(shardId);
    if (iterator == null) {
        final GetShardIteratorRequest req = getShardIteratorRequest(
                shardId,
                config.streamArnForShard(shardId),
                storedSequenceNumber(sourcePartition(shardId))
        );
        iterator = streamsClient.getShardIterator(req).getShardIterator();
        shardIterators.put(shardId, iterator);
    }
    return iterator;
}