Example usage for com.amazonaws.services.kinesis.model StreamDescription isHasMoreShards

List of usage examples for com.amazonaws.services.kinesis.model StreamDescription isHasMoreShards

Introduction

In this page you can find the example usage for com.amazonaws.services.kinesis.model StreamDescription isHasMoreShards.

Prototype


public Boolean isHasMoreShards() 

Source Link

Document

If set to true, more shards in the stream are available to describe.

Usage

From source file:org.apache.druid.indexing.kinesis.KinesisRecordSupplier.java

License:Apache License

@Override
public Set<String> getPartitionIds(String stream) {
    return wrapExceptions(() -> {
        final Set<String> retVal = new HashSet<>();
        DescribeStreamRequest request = new DescribeStreamRequest();
        request.setStreamName(stream);//from   ww w  . ja va2s .com

        while (request != null) {
            final DescribeStreamResult result = kinesis.describeStream(request);
            final StreamDescription streamDescription = result.getStreamDescription();
            final List<Shard> shards = streamDescription.getShards();

            for (Shard shard : shards) {
                retVal.add(shard.getShardId());
            }

            if (streamDescription.isHasMoreShards()) {
                request.setExclusiveStartShardId(Iterables.getLast(shards).getShardId());
            } else {
                request = null;
            }
        }

        return retVal;
    });
}