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

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

Introduction

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

Prototype


public void setHasMoreShards(Boolean hasMoreShards) 

Source Link

Document

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

Usage

From source file:com.facebook.presto.kinesis.util.MockKinesisClient.java

License:Apache License

@Override
public DescribeStreamResult describeStream(DescribeStreamRequest describeStreamRequest)
        throws AmazonServiceException, AmazonClientException {
    InternalStream theStream = this.getStream(describeStreamRequest.getStreamName());
    if (theStream != null) {
        StreamDescription desc = new StreamDescription();
        desc = desc.withStreamName(theStream.getStreamName()).withStreamStatus(theStream.getStreamStatus())
                .withStreamARN(theStream.getStreamARN());

        if (describeStreamRequest.getExclusiveStartShardId() == null
                || describeStreamRequest.getExclusiveStartShardId().isEmpty()) {
            desc.setShards(this.getShards(theStream));
            desc.setHasMoreShards(false);
        } else {/*from ww  w. j  a va  2 s.c  o m*/
            // Filter from given shard Id, or may not have any more
            String startId = describeStreamRequest.getExclusiveStartShardId();
            desc.setShards(this.getShards(theStream, startId));
            desc.setHasMoreShards(false);
        }

        DescribeStreamResult result = new DescribeStreamResult();
        result = result.withStreamDescription(desc);
        return result;
    } else {
        throw new AmazonClientException("This stream does not exist!");
    }
}