Search in sources :

Example 1 with CreateStreamRequest

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

the class KinesisTestHelper method createStream.

public void createStream(int shardCount) {
    if (streamExists()) {
        throw new IllegalStateException("Stream already exists");
    }
    callSafely(() -> {
        CreateStreamRequest request = new CreateStreamRequest();
        request.setShardCount(shardCount);
        request.setStreamName(stream);
        return kinesis.createStream(request);
    }, "stream creation");
    waitForStreamToActivate();
}
Also used : CreateStreamRequest(com.amazonaws.services.kinesis.model.CreateStreamRequest)

Example 2 with CreateStreamRequest

use of com.amazonaws.services.kinesis.model.CreateStreamRequest in project apex-malhar by apache.

the class KinesisOperatorTestBase method beforeTest.

@Before
public void beforeTest() {
    CreateStreamRequest streamRequest = null;
    createClient();
    for (int i = 0; i < 100; ++i) {
        try {
            streamName = streamNamePrefix + i;
            streamRequest = new CreateStreamRequest();
            streamRequest.setStreamName(streamName);
            streamRequest.setShardCount(shardCount);
            client.createStream(streamRequest);
            logger.info("created stream {}.", streamName);
            Thread.sleep(30000);
            break;
        } catch (ResourceInUseException riue) {
            logger.warn("Resource is in use.", riue.getMessage());
        } catch (Exception e) {
            logger.error("Got exception.", e);
            throw new RuntimeException(e);
        }
    }
}
Also used : CreateStreamRequest(com.amazonaws.services.kinesis.model.CreateStreamRequest) ResourceInUseException(com.amazonaws.services.kinesis.model.ResourceInUseException) ResourceInUseException(com.amazonaws.services.kinesis.model.ResourceInUseException) Before(org.junit.Before)

Aggregations

CreateStreamRequest (com.amazonaws.services.kinesis.model.CreateStreamRequest)2 ResourceInUseException (com.amazonaws.services.kinesis.model.ResourceInUseException)1 Before (org.junit.Before)1