Search in sources :

Example 21 with ListShardsResult

use of com.amazonaws.services.kinesis.model.ListShardsResult in project hazelcast by hazelcast.

the class KinesisTestHelper method listOpenShards.

private List<Shard> listOpenShards() {
    List<Shard> shards = new ArrayList<>();
    String nextToken = null;
    do {
        // only the currently open shards
        ShardFilterType filterType = ShardFilterType.AT_LATEST;
        ListShardsRequest request = RangeMonitor.listAllShardsRequest(stream, nextToken, filterType);
        ListShardsResult response = kinesis.listShards(request);
        shards.addAll(response.getShards());
        nextToken = response.getNextToken();
    } while (nextToken != null);
    return shards;
}
Also used : ListShardsResult(com.amazonaws.services.kinesis.model.ListShardsResult) ListShardsRequest(com.amazonaws.services.kinesis.model.ListShardsRequest) ShardFilterType(com.amazonaws.services.kinesis.model.ShardFilterType) ArrayList(java.util.ArrayList) Shard(com.amazonaws.services.kinesis.model.Shard)

Aggregations

ListShardsResult (com.amazonaws.services.kinesis.model.ListShardsResult)21 Shard (com.amazonaws.services.kinesis.model.Shard)19 ListShardsRequest (com.amazonaws.services.kinesis.model.ListShardsRequest)18 Test (org.junit.Test)12 ShardFilter (com.amazonaws.services.kinesis.model.ShardFilter)9 SdkClientException (com.amazonaws.SdkClientException)6 DescribeStreamSummaryRequest (com.amazonaws.services.kinesis.model.DescribeStreamSummaryRequest)5 DescribeStreamSummaryResult (com.amazonaws.services.kinesis.model.DescribeStreamSummaryResult)5 Instant (org.joda.time.Instant)5 AmazonKinesis (com.amazonaws.services.kinesis.AmazonKinesis)4 StreamDescriptionSummary (com.amazonaws.services.kinesis.model.StreamDescriptionSummary)4 Datapoint (com.amazonaws.services.cloudwatch.model.Datapoint)3 AmazonKinesisClient (com.amazonaws.services.kinesis.AmazonKinesisClient)3 AmazonKinesisException (com.amazonaws.services.kinesis.model.AmazonKinesisException)3 LimitExceededException (com.amazonaws.services.kinesis.model.LimitExceededException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2