com.amazonaws.services.kinesis.model.CreateStreamRequest Java Examples

The following examples show how to use com.amazonaws.services.kinesis.model.CreateStreamRequest. 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: SpringLocalstackDockerRunnerTest.java    From spring-localstack with Apache License 2.0 6 votes vote down vote up
@Test
public void testKinesis() throws Exception {
    AmazonKinesis kinesis = amazonDockerClientsHolder.amazonKinesis();

    ListStreamsResult streamsResult = kinesis.listStreams();
    assertThat(streamsResult.getStreamNames().size(), is(0));

    CreateStreamRequest createStreamRequest = new CreateStreamRequest()
        .withStreamName("test-stream")
        .withShardCount(2);

    kinesis.createStream(createStreamRequest);

    streamsResult = kinesis.listStreams();
    assertThat(streamsResult.getStreamNames(), hasItem("test-stream"));
}
 
Example #2
Source File: EmbeddedKinesisStream.java    From presto-kinesis with Apache License 2.0 6 votes vote down vote up
public void createStream(int shardCount, String streamName)
{
    CreateStreamRequest createStreamRequest = new CreateStreamRequest();
    createStreamRequest.setStreamName(streamName);
    createStreamRequest.setShardCount(shardCount);

    amazonKinesisClient.createStream(createStreamRequest);
    try {
        while (checkStreamStatus(streamName).equals("ACTIVE") == false) {
            MILLISECONDS.sleep(1000);
        }
    }
    catch (Exception e) {
    }

    streamsCreated.add(streamName);
}
 
Example #3
Source File: MockKinesisClient.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public CreateStreamResult createStream(CreateStreamRequest createStreamRequest)
        throws AmazonClientException
{
    // Setup method to create a new stream:
    InternalStream stream = new InternalStream(createStreamRequest.getStreamName(), createStreamRequest.getShardCount(), true);
    this.streams.add(stream);
    return new CreateStreamResult();
}
 
Example #4
Source File: EmbeddedKinesisStream.java    From presto with Apache License 2.0 5 votes vote down vote up
public void createStream(int shardCount, String streamName)
{
    CreateStreamRequest createStreamRequest = new CreateStreamRequest();
    createStreamRequest.setStreamName(streamName);
    createStreamRequest.setShardCount(shardCount);

    amazonKinesisClient.createStream(createStreamRequest);
    try {
        while (!checkStreamStatus(streamName).equals("ACTIVE")) {
            MILLISECONDS.sleep(1000);
        }
    }
    catch (Exception e) {
    }
}
 
Example #5
Source File: MockKinesisClient.java    From presto-kinesis with Apache License 2.0 5 votes vote down vote up
@Override
public CreateStreamResult createStream(CreateStreamRequest createStreamRequest) throws AmazonServiceException, AmazonClientException
{
    // Setup method to create a new stream:
    InternalStream stream = new InternalStream(createStreamRequest.getStreamName(), createStreamRequest.getShardCount(), true);
    this.streams.add(stream);
    return new CreateStreamResult();
}
 
Example #6
Source File: MockKinesisClient.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public CreateStreamResult createStream(String streamName, Integer integer)
        throws AmazonClientException
{
    return this.createStream((new CreateStreamRequest()).withStreamName(streamName).withShardCount(integer));
}
 
Example #7
Source File: AmazonKinesisMock.java    From beam with Apache License 2.0 4 votes vote down vote up
@Override
public CreateStreamResult createStream(CreateStreamRequest createStreamRequest) {
  throw new RuntimeException("Not implemented");
}
 
Example #8
Source File: MockKinesisClient.java    From presto-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
public CreateStreamResult createStream(String s, Integer integer) throws AmazonServiceException, AmazonClientException
{
    return this.createStream((new CreateStreamRequest()).withStreamName(s).withShardCount(integer));
}