Java Code Examples for com.amazonaws.services.kinesis.model.StreamDescription#setHasMoreShards()

The following examples show how to use com.amazonaws.services.kinesis.model.StreamDescription#setHasMoreShards() . 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: MockKinesisClient.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public DescribeStreamResult describeStream(DescribeStreamRequest describeStreamRequest)
        throws AmazonClientException
{
    InternalStream theStream = this.getStream(describeStreamRequest.getStreamName());
    if (theStream == null) {
        throw new AmazonClientException("This stream does not exist!");
    }

    StreamDescription desc = new StreamDescription();
    desc = desc.withStreamName(theStream.getStreamName()).withStreamStatus(theStream.getStreamStatus()).withStreamARN(theStream.getStreamAmazonResourceName());

    if (describeStreamRequest.getExclusiveStartShardId() == null || describeStreamRequest.getExclusiveStartShardId().isEmpty()) {
        desc.setShards(this.getShards(theStream));
        desc.setHasMoreShards(false);
    }
    else {
        // 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;
}
 
Example 2
Source File: MockKinesisClient.java    From presto-kinesis with Apache License 2.0 5 votes vote down vote up
@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 {
            // 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!");
    }
}