Reputation: 631
I want to create Kinesis stream using Java. So I followed aws doc(URL:http://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-create-stream.html). According to that, 1st of all i have to create Kinesis Streams Client. I try it by given code which is:
client = new AmazonKinesisClient();
I'm using eclipse with aws toolkit for eclipse,java version "1.8.0_131" in Windows environment. Above code give me this error:
The constructor AmazonKinesisClient() is deprecated
How to overcome this problem?
Upvotes: 4
Views: 1926
Reputation: 11113
Deprecation warnings is not an error, it's just the compiler warning you that something has been deprecated and may be removed in the future - your code will still work even if you're using new AmazonKinesisClient()
, until that constructor is removed from the SDK sometime in the future.
The new way of creating clients in the AWS SDK is to use the builder API like this:
final AmazonKinesisClientBuilder builder = AmazonKinesisClient.builder();
final AmazonKinesis client = builder.build();
This way, you can use builder
to customize the client, like setting region or using STS credentials.
If you just want to get an instance using the default settings you can do:
final AmazonKinesis client = AmazonKinesisClient.builder().build();
Upvotes: 3