Search in sources :

Example 6 with KinesisException

use of software.amazon.awssdk.services.kinesis.model.KinesisException in project aws-doc-sdk-examples by awsdocs.

the class AddDataShards method addShards.

// snippet-start:[kinesis.java2.AddDataShards.main]
public static void addShards(KinesisClient kinesisClient, String name, int goalShards) {
    try {
        UpdateShardCountRequest request = UpdateShardCountRequest.builder().scalingType("UNIFORM_SCALING").streamName(name).targetShardCount(goalShards).build();
        UpdateShardCountResponse response = kinesisClient.updateShardCount(request);
        System.out.println(response.streamName() + " has updated shard count to " + response.currentShardCount());
    } catch (KinesisException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : KinesisException(software.amazon.awssdk.services.kinesis.model.KinesisException) UpdateShardCountResponse(software.amazon.awssdk.services.kinesis.model.UpdateShardCountResponse) UpdateShardCountRequest(software.amazon.awssdk.services.kinesis.model.UpdateShardCountRequest)

Example 7 with KinesisException

use of software.amazon.awssdk.services.kinesis.model.KinesisException in project aws-doc-sdk-examples by awsdocs.

the class CreateDataStream method createStream.

// snippet-start:[kinesis.java2.create.main]
public static void createStream(KinesisClient kinesisClient, String streamName) {
    try {
        CreateStreamRequest streamReq = CreateStreamRequest.builder().streamName(streamName).shardCount(1).build();
        kinesisClient.createStream(streamReq);
    } catch (KinesisException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : KinesisException(software.amazon.awssdk.services.kinesis.model.KinesisException) CreateStreamRequest(software.amazon.awssdk.services.kinesis.model.CreateStreamRequest)

Example 8 with KinesisException

use of software.amazon.awssdk.services.kinesis.model.KinesisException in project aws-doc-sdk-examples by awsdocs.

the class DeleteDataStream method deleteStream.

// snippet-start:[kinesis.java2.delete.main]
public static void deleteStream(KinesisClient kinesisClient, String streamName) {
    try {
        DeleteStreamRequest delStream = DeleteStreamRequest.builder().streamName(streamName).build();
        kinesisClient.deleteStream(delStream);
    } catch (KinesisException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : DeleteStreamRequest(software.amazon.awssdk.services.kinesis.model.DeleteStreamRequest) KinesisException(software.amazon.awssdk.services.kinesis.model.KinesisException)

Aggregations

KinesisException (software.amazon.awssdk.services.kinesis.model.KinesisException)8 CreateStreamRequest (software.amazon.awssdk.services.kinesis.model.CreateStreamRequest)1 DeleteStreamRequest (software.amazon.awssdk.services.kinesis.model.DeleteStreamRequest)1 DescribeLimitsRequest (software.amazon.awssdk.services.kinesis.model.DescribeLimitsRequest)1 DescribeLimitsResponse (software.amazon.awssdk.services.kinesis.model.DescribeLimitsResponse)1 DescribeStreamRequest (software.amazon.awssdk.services.kinesis.model.DescribeStreamRequest)1 DescribeStreamResponse (software.amazon.awssdk.services.kinesis.model.DescribeStreamResponse)1 ListShardsRequest (software.amazon.awssdk.services.kinesis.model.ListShardsRequest)1 ListShardsResponse (software.amazon.awssdk.services.kinesis.model.ListShardsResponse)1 PutRecordRequest (software.amazon.awssdk.services.kinesis.model.PutRecordRequest)1 RegisterStreamConsumerRequest (software.amazon.awssdk.services.kinesis.model.RegisterStreamConsumerRequest)1 RegisterStreamConsumerResponse (software.amazon.awssdk.services.kinesis.model.RegisterStreamConsumerResponse)1 UpdateShardCountRequest (software.amazon.awssdk.services.kinesis.model.UpdateShardCountRequest)1 UpdateShardCountResponse (software.amazon.awssdk.services.kinesis.model.UpdateShardCountResponse)1