Addressing comments, deprectaing classes instead of methods. Using the @deprecated annotation for notes on why deprecating.
This commit is contained in:
parent
42f60ed1bf
commit
b126a78fb1
4 changed files with 23 additions and 47 deletions
|
|
@ -50,6 +50,9 @@ public interface IKinesisProxy {
|
||||||
* being deprecated. This method uses DescribeStream call, which is throttled at 10 calls per account by default.
|
* 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.
|
* 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.
|
* @param startShardId exclusive start shardId - used when paginating the list of shards.
|
||||||
* @return DescribeStreamOutput object containing a description of the stream.
|
* @return DescribeStreamOutput object containing a description of the stream.
|
||||||
* @throws ResourceNotFoundException The Kinesis stream was not found
|
* @throws ResourceNotFoundException The Kinesis stream was not found
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@ import com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibC
|
||||||
/**
|
/**
|
||||||
* Interface for a KinesisProxyFactory.
|
* Interface for a KinesisProxyFactory.
|
||||||
*
|
*
|
||||||
* <p>
|
* @deprecated Deprecating since KinesisProxy is just created once, there is no use of a factory.
|
||||||
* Note: Deprecating since KinesisProxy is just created once, there is no use of a factory.
|
*
|
||||||
* </p>
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public interface IKinesisProxyFactory {
|
public interface IKinesisProxyFactory {
|
||||||
|
|
@ -32,7 +31,6 @@ public interface IKinesisProxyFactory {
|
||||||
* @param streamName Stream from which data is consumed.
|
* @param streamName Stream from which data is consumed.
|
||||||
* @return IKinesisProxy object.
|
* @return IKinesisProxy object.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
IKinesisProxy getProxy(String streamName);
|
IKinesisProxy getProxy(String streamName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,15 @@ public class KinesisProxy implements IKinesisProxyExtended {
|
||||||
private final int maxListShardsRetryAttempts;
|
private final int maxListShardsRetryAttempts;
|
||||||
private boolean isKinesisClient = true;
|
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
|
@Deprecated
|
||||||
private static AmazonKinesisClient buildClientSettingEndpoint(AWSCredentialsProvider credentialProvider,
|
private static AmazonKinesisClient buildClientSettingEndpoint(AWSCredentialsProvider credentialProvider,
|
||||||
String endpoint,
|
String endpoint,
|
||||||
|
|
@ -95,11 +104,10 @@ public class KinesisProxy implements IKinesisProxyExtended {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public constructor.
|
* Public constructor.
|
||||||
* <p>
|
*
|
||||||
* 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(KinesisClientLibConfiguration, AmazonKinesis)} or
|
||||||
* {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object.
|
* {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object.
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param streamName Data records will be fetched from this stream
|
* @param streamName Data records will be fetched from this stream
|
||||||
* @param credentialProvider Provides credentials for signing Kinesis requests
|
* @param credentialProvider Provides credentials for signing Kinesis requests
|
||||||
|
|
@ -115,11 +123,10 @@ public class KinesisProxy implements IKinesisProxyExtended {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public constructor.
|
* Public constructor.
|
||||||
* <p>
|
*
|
||||||
* 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(KinesisClientLibConfiguration, AmazonKinesis)} or
|
||||||
* {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object.
|
* {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object.
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param streamName Data records will be fetched from this stream
|
* @param streamName Data records will be fetched from this stream
|
||||||
* @param credentialProvider Provides credentials for signing Kinesis requests
|
* @param credentialProvider Provides credentials for signing Kinesis requests
|
||||||
|
|
@ -151,11 +158,10 @@ public class KinesisProxy implements IKinesisProxyExtended {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public constructor.
|
* Public constructor.
|
||||||
* <p>
|
*
|
||||||
* 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(KinesisClientLibConfiguration, AmazonKinesis)} or
|
||||||
* {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object.
|
* {@link #KinesisProxy(String, AmazonKinesis, long, int, long, int)} to create the object.
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param streamName Data records will be fetched from this stream
|
* @param streamName Data records will be fetched from this stream
|
||||||
* @param credentialProvider Provides credentials for signing Kinesis requests
|
* @param credentialProvider Provides credentials for signing Kinesis requests
|
||||||
|
|
@ -236,6 +242,7 @@ public class KinesisProxy implements IKinesisProxyExtended {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public DescribeStreamResult getStreamInfo(String startShardId)
|
public DescribeStreamResult getStreamInfo(String startShardId)
|
||||||
throws ResourceNotFoundException, LimitExceededException {
|
throws ResourceNotFoundException, LimitExceededException {
|
||||||
LOG.info("Using DescribeStream calls to get shards list");
|
LOG.info("Using DescribeStream calls to get shards list");
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibC
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory used for instantiating KinesisProxy objects (to fetch data from Kinesis).
|
* 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
|
@Deprecated
|
||||||
public class KinesisProxyFactory implements IKinesisProxyFactory {
|
public class KinesisProxyFactory implements IKinesisProxyFactory {
|
||||||
|
|
@ -36,19 +38,13 @@ public class KinesisProxyFactory implements IKinesisProxyFactory {
|
||||||
private final int maxDescribeStreamRetryAttempts;
|
private final int maxDescribeStreamRetryAttempts;
|
||||||
private final long listShardsBackoffTimeInMillis;
|
private final long listShardsBackoffTimeInMillis;
|
||||||
private final int maxListShardsRetryAttempts;
|
private final int maxListShardsRetryAttempts;
|
||||||
private KinesisClientLibConfiguration configuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for creating a KinesisProxy factory, using the specified credentials provider and endpoint.
|
* Constructor for creating a KinesisProxy factory, using the specified credentials provider and endpoint.
|
||||||
* <p>
|
|
||||||
* Note: Deprecating, moving forward please use
|
|
||||||
* {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices.
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param credentialProvider credentials provider used to sign requests
|
* @param credentialProvider credentials provider used to sign requests
|
||||||
* @param endpoint Amazon Kinesis endpoint to use
|
* @param endpoint Amazon Kinesis endpoint to use
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, String endpoint) {
|
public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, String endpoint) {
|
||||||
this(credentialProvider, new ClientConfiguration(), endpoint, defaultServiceName, defaultRegionId,
|
this(credentialProvider, new ClientConfiguration(), endpoint, defaultServiceName, defaultRegionId,
|
||||||
DEFAULT_DESCRIBE_STREAM_BACKOFF_MILLIS, DEFAULT_DESCRIBE_STREAM_RETRY_TIMES,
|
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.
|
* Constructor for KinesisProxy factory using the client configuration to use when interacting with Kinesis.
|
||||||
* <p>
|
|
||||||
* Note: Deprecating, moving forward please use
|
|
||||||
* {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices.
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param credentialProvider credentials provider used to sign requests
|
* @param credentialProvider credentials provider used to sign requests
|
||||||
* @param clientConfig Client Configuration used when instantiating an AmazonKinesisClient
|
* @param clientConfig Client Configuration used when instantiating an AmazonKinesisClient
|
||||||
* @param endpoint Amazon Kinesis endpoint to use
|
* @param endpoint Amazon Kinesis endpoint to use
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public KinesisProxyFactory(AWSCredentialsProvider credentialProvider,
|
public KinesisProxyFactory(AWSCredentialsProvider credentialProvider,
|
||||||
ClientConfiguration clientConfig,
|
ClientConfiguration clientConfig,
|
||||||
String endpoint) {
|
String endpoint) {
|
||||||
|
|
@ -79,15 +70,10 @@ public class KinesisProxyFactory implements IKinesisProxyFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor may be used to specify the AmazonKinesisClient to use.
|
* This constructor may be used to specify the AmazonKinesisClient to use.
|
||||||
* <p>
|
|
||||||
* Note: Deprecating, moving forward please use
|
|
||||||
* {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices.
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param credentialProvider credentials provider used to sign requests
|
* @param credentialProvider credentials provider used to sign requests
|
||||||
* @param client AmazonKinesisClient used to fetch data from Kinesis
|
* @param client AmazonKinesisClient used to fetch data from Kinesis
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, AmazonKinesis client) {
|
public KinesisProxyFactory(AWSCredentialsProvider credentialProvider, AmazonKinesis client) {
|
||||||
this(credentialProvider, client, DEFAULT_DESCRIBE_STREAM_BACKOFF_MILLIS, DEFAULT_DESCRIBE_STREAM_RETRY_TIMES,
|
this(credentialProvider, client, DEFAULT_DESCRIBE_STREAM_BACKOFF_MILLIS, DEFAULT_DESCRIBE_STREAM_RETRY_TIMES,
|
||||||
KinesisClientLibConfiguration.DEFAULT_LIST_SHARDS_BACKOFF_TIME_IN_MILLIS,
|
KinesisClientLibConfiguration.DEFAULT_LIST_SHARDS_BACKOFF_TIME_IN_MILLIS,
|
||||||
|
|
@ -96,10 +82,6 @@ public class KinesisProxyFactory implements IKinesisProxyFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally and for development/testing.
|
* Used internally and for development/testing.
|
||||||
* <p>
|
|
||||||
* Note: Deprecating, moving forward please use
|
|
||||||
* {@link #KinesisProxyFactory(AWSCredentialsProvider, AmazonKinesis)}, it uses AWS best practices.
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param credentialProvider credentials provider used to sign requests
|
* @param credentialProvider credentials provider used to sign requests
|
||||||
* @param clientConfig Client Configuration used when instantiating an AmazonKinesisClient
|
* @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 describeStreamBackoffTimeInMillis backoff time for describing stream in millis
|
||||||
* @param maxDescribeStreamRetryAttempts Number of retry attempts for DescribeStream calls
|
* @param maxDescribeStreamRetryAttempts Number of retry attempts for DescribeStream calls
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
KinesisProxyFactory(AWSCredentialsProvider credentialProvider,
|
KinesisProxyFactory(AWSCredentialsProvider credentialProvider,
|
||||||
ClientConfiguration clientConfig,
|
ClientConfiguration clientConfig,
|
||||||
String endpoint,
|
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).
|
* Used internally in the class (and for development/testing).
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue