diff --git a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxy.java b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxy.java index 2e5a8c0a..e10e060e 100644 --- a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxy.java +++ b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxy.java @@ -50,6 +50,9 @@ public interface IKinesisProxy { * being deprecated. This method uses DescribeStream call, which is throttled at 10 calls per account by default. * If possible try to use ListShards call available in the client, or use the getShardList to get shard info. * + * @deprecated This method uses DescribeStream calls, which is throttled at account level. The proxy will internally + * use ListShards for KinesisStreams to get the information about the shards for a given stream. + * * @param startShardId exclusive start shardId - used when paginating the list of shards. * @return DescribeStreamOutput object containing a description of the stream. * @throws ResourceNotFoundException The Kinesis stream was not found diff --git a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxyFactory.java b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxyFactory.java index 95d8cda3..871fb3e1 100644 --- a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxyFactory.java +++ b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/IKinesisProxyFactory.java @@ -20,9 +20,8 @@ import com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibC /** * Interface for a KinesisProxyFactory. * - *
- * Note: Deprecating since KinesisProxy is just created once, there is no use of a factory. - *
+ * @deprecated Deprecating since KinesisProxy is just created once, there is no use of a factory. + * */ @Deprecated public interface IKinesisProxyFactory { @@ -32,7 +31,6 @@ public interface IKinesisProxyFactory { * @param streamName Stream from which data is consumed. * @return IKinesisProxy object. */ - @Deprecated IKinesisProxy getProxy(String streamName); } diff --git a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxy.java b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxy.java index 771832c2..76720214 100644 --- a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxy.java +++ b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxy.java @@ -82,6 +82,15 @@ public class KinesisProxy implements IKinesisProxyExtended { private final int maxListShardsRetryAttempts; private boolean isKinesisClient = true; + /** + * @deprecated We expect the client to be passed to the proxy, and the proxy will not require to create it. + * + * @param credentialProvider + * @param endpoint + * @param serviceName + * @param regionId + * @return + */ @Deprecated private static AmazonKinesisClient buildClientSettingEndpoint(AWSCredentialsProvider credentialProvider, String endpoint, @@ -95,11 +104,10 @@ public class KinesisProxy implements IKinesisProxyExtended { /** * Public constructor. - *- * Note: Deprecating constructor, this constructor doesn't use AWS best practices, moving forward please use + * + * @deprecated Deprecating constructor, this constructor doesn't use AWS best practices, moving forward please use * {@link #KinesisProxy(KinesisClientLibConfiguration, AmazonKinesis)} or * {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object. - *
* * @param streamName Data records will be fetched from this stream * @param credentialProvider Provides credentials for signing Kinesis requests @@ -115,11 +123,10 @@ public class KinesisProxy implements IKinesisProxyExtended { /** * Public constructor. - *- * Note: Deprecating constructor, this constructor doesn't use AWS best practices, moving forward please use + * + * @deprecated Deprecating constructor, this constructor doesn't use AWS best practices, moving forward please use * {@link #KinesisProxy(KinesisClientLibConfiguration, AmazonKinesis)} or * {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object. - *
* * @param streamName Data records will be fetched from this stream * @param credentialProvider Provides credentials for signing Kinesis requests @@ -151,11 +158,10 @@ public class KinesisProxy implements IKinesisProxyExtended { /** * Public constructor. - *- * Note: Deprecating constructor, this constructor doesn't use AWS best practices, moving forward please use + * + * @deprecated Deprecating constructor, this constructor doesn't use AWS best practices, moving forward please use * {@link #KinesisProxy(KinesisClientLibConfiguration, AmazonKinesis)} or * {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object. - *
* * @param streamName Data records will be fetched from this stream * @param credentialProvider Provides credentials for signing Kinesis requests @@ -236,6 +242,7 @@ public class KinesisProxy implements IKinesisProxyExtended { * {@inheritDoc} */ @Override + @Deprecated public DescribeStreamResult getStreamInfo(String startShardId) throws ResourceNotFoundException, LimitExceededException { LOG.info("Using DescribeStream calls to get shards list"); diff --git a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxyFactory.java b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxyFactory.java index c7a9296c..7a0901e0 100644 --- a/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxyFactory.java +++ b/src/main/java/com/amazonaws/services/kinesis/clientlibrary/proxies/KinesisProxyFactory.java @@ -22,6 +22,8 @@ import com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibC /** * Factory used for instantiating KinesisProxy objects (to fetch data from Kinesis). + * + * @deprecated Will be removed since proxy is created only once, we don't need a factory. */ @Deprecated public class KinesisProxyFactory implements IKinesisProxyFactory { @@ -36,19 +38,13 @@ public class KinesisProxyFactory implements IKinesisProxyFactory { private final int maxDescribeStreamRetryAttempts; private final long listShardsBackoffTimeInMillis; private final int maxListShardsRetryAttempts; - private KinesisClientLibConfiguration configuration; /** * Constructor for creating a KinesisProxy factory, using the specified credentials provider and endpoint. - *- * Note: Deprecating, moving forward please use - * {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices. - *
* * @param credentialProvider credentials provider used to sign requests * @param endpoint Amazon Kinesis endpoint to use */ - @Deprecated public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, String endpoint) { this(credentialProvider, new ClientConfiguration(), endpoint, defaultServiceName, defaultRegionId, DEFAULT_DESCRIBE_STREAM_BACKOFF_MILLIS, DEFAULT_DESCRIBE_STREAM_RETRY_TIMES, @@ -58,16 +54,11 @@ public class KinesisProxyFactory implements IKinesisProxyFactory { /** * Constructor for KinesisProxy factory using the client configuration to use when interacting with Kinesis. - *- * Note: Deprecating, moving forward please use - * {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices. - *
* * @param credentialProvider credentials provider used to sign requests * @param clientConfig Client Configuration used when instantiating an AmazonKinesisClient * @param endpoint Amazon Kinesis endpoint to use */ - @Deprecated public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, ClientConfiguration clientConfig, String endpoint) { @@ -79,15 +70,10 @@ public class KinesisProxyFactory implements IKinesisProxyFactory { /** * This constructor may be used to specify the AmazonKinesisClient to use. - *- * Note: Deprecating, moving forward please use - * {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices. - *
* * @param credentialProvider credentials provider used to sign requests * @param client AmazonKinesisClient used to fetch data from Kinesis */ - @Deprecated public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, AmazonKinesis client) { this(credentialProvider, client, DEFAULT_DESCRIBE_STREAM_BACKOFF_MILLIS, DEFAULT_DESCRIBE_STREAM_RETRY_TIMES, KinesisClientLibConfiguration.DEFAULT_LIST_SHARDS_BACKOFF_TIME_IN_MILLIS, @@ -96,10 +82,6 @@ public class KinesisProxyFactory implements IKinesisProxyFactory { /** * Used internally and for development/testing. - *- * Note: Deprecating, moving forward please use - * {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices. - *
* * @param credentialProvider credentials provider used to sign requests * @param clientConfig Client Configuration used when instantiating an AmazonKinesisClient @@ -109,7 +91,6 @@ public class KinesisProxyFactory implements IKinesisProxyFactory { * @param describeStreamBackoffTimeInMillis backoff time for describing stream in millis * @param maxDescribeStreamRetryAttempts Number of retry attempts for DescribeStream calls */ - @Deprecated KinesisProxyFactory(AWSCredentialsProvider credentialProvider, ClientConfiguration clientConfig, String endpoint, @@ -131,19 +112,6 @@ public class KinesisProxyFactory implements IKinesisProxyFactory { } - /** - * Creating KinesisProxyFactory using Config and Client objects, that will be used by the proxy. - * - * @param configuration Config that will be used to create the Proxy - * @param client Client that will be used by the Proxy - */ - public KinesisProxyFactory(final KinesisClientLibConfiguration configuration, final AmazonKinesis client) { - this(configuration.getKinesisCredentialsProvider(), client, DEFAULT_DESCRIBE_STREAM_BACKOFF_MILLIS, - DEFAULT_DESCRIBE_STREAM_RETRY_TIMES, configuration.getListShardsBackoffTimeInMillis(), - configuration.getMaxListShardsRetryAttempts()); - this.configuration = configuration; - } - /** * Used internally in the class (and for development/testing). *