Commit graph

151 commits

Author SHA1 Message Date
Pfifer, Justin
258be9a504 Release 2.0.0 of the Amazon Kinesis Client for Java
* Added support for Enhanced Fan Out.
  Enhanced Fan Out provides for lower end to end latency, and increased number of consumers per stream.
  * Records are now delivered via streaming, reducing end-to-end latency.
  * The Amazon Kinesis Client will automatically register a new consumer if required.
    When registering a new consumer, the Kinesis Client will default to the application name unless configured otherwise.
  * New configuration options are available to configure Enhanced Fan Out.
  * `SubscribeToShard` maintains long lived connections with Kinesis, which in the AWS Java SDK 2.0 is limited by default.
    The `KinesisClientUtil` has been added to assist configuring the `maxConcurrency` of the `KinesisAsyncClient`.
    __WARNING: The Amazon Kinesis Client may see significantly increased latency, unless the `KinesisAsyncClient` is configured to have a `maxConcurrency` high enough to allow all leases plus additional usages of the `KinesisAsyncClient`.__

  | Name            | Default | Description                                                                                                         |
  |-----------------|---------|---------------------------------------------------------------------------------------------------------------------|
  | consumerArn     | Unset   | The ARN for an already created consumer.  If this is set, the Kinesis Client will not attempt to create a consumer. |
  | streamName      | Unset   | The name of the stream that a consumer should be create for if necessary                                            |
  | consumerName    | Unset   | The name of the consumer to create.  If this is not set the applicationName will be used instead.                   |
  | applicationName | Unset   | The name of the application.  This is used as the name of the consumer unless consumerName is set.                  |

* Modular Configuration of the Kinesis Client
  The Kinesis Client has migrated to a modular configuration system, and the `KinesisClientLibConfiguration` class has been removed.
  Configuration has been split into 7 classes.  Default versions of the configuration can be created from the `ConfigsBuilder`.
  Please see the migration guide for more information
  * `CheckpointConfig`
  * `CoordinatorConfig`
  * `LeaseManagementConfig`
  * `LifecycleConfig`
  * `MetricsConfig`
  * `ProcessorConfig`
  * `RetrievalConfig`

* Upgraded to AWS Java SDK 2.0
  The Kinesis Client now uses the AWS Java SDK 2.0.  The dependency on AWS Java SDK 1.11 has been removed.
  All configurations will only accept 2.0 clients.
  * When configuring the `KinesisAsyncClient` the `KinesisClientUtil#createKinesisAsyncClient` can be used to configure the Kinesis Client
  * __If you need support for AWS Java SDK 1.11 you will need to add a direct dependency.__
    __When adding a dependency you must ensure that the 1.11 versions of Jackson dependencies are excluded__
    Please see the migration guide for more information

* MultiLangDaemon is now a separate module
  The MultiLangDaemon has been separated to its own Maven module and is no longer available in `amazon-kinesis-client`.  To include the MultiLangDaemon, add a dependency on `amazon-kinesis-client-multilang`.
2018-08-02 12:19:46 -07:00
Justin Pfifer
f1d60ec1a6 Remove tests that no longer work (#346)
The new version of the SDK no longer returns null on an unknown
region.  There's not much we can do but run with whatever region is configured
2018-06-12 14:29:22 -07:00
Justin Pfifer
2483f8cbf8 Added cache updating behavior for GetShard (#344)
* Added cache updating behavior for GetShard

Customer are occasionally seeing messages about being unable to
retrieve shard information, which is logged as a warning.  This change
will allow the shard map to be updated even when there is no re-shard
operation.

This now triggers a shard list update if there is 1000 cache misses,
or a cache miss occurs when the cache is more than 30 seconds old.
For Kinesis the updates will use ListShards, and for DynamoDB Streams
it will continue to use DescribeStream.

* Adjust some logging, and the zeroing of cache misses a bit

Only log about cache refresh if it's the thread doing the cache
refresh.  If after synchronizing the shard is present, accept that
someone else loaded the shard map, and move on.

If the cache was reloaded, and the shard was found the current thread
will reset the cache misses.

The warnings for the cache miss was using a modulo of 1000 which is
the maximum value for cache misses, so wasn't to useful.
2018-06-07 13:25:03 -07:00
Marcin Ciszak
a84885db79 Enables property for setting AT_TIMESTAMP shard iterator initial time… (#342)
Allows setting the timestamp for InitialPositiinInStream.AT_TIMESTAMP from a properties file.
2018-05-29 09:52:08 -07:00
Sahil Palvia
be60a5507d Logging fixes for tests (#340)
* Adding log4j dependency for testing. Moving log4j.properties from test/src to test/resources.
2018-05-17 13:27:35 -07:00
Sahil Palvia
86cc068454 Fix for Worker to handle immutable clients (#305) 2018-05-04 10:06:13 -07:00
Justin Pfifer
5d183e0197 Release 1.9.1 of the Amazon Kinesis Client Library for Java (#337)
* Release 1.9.1 of the Amazon Kinesis Client Library for Java

Updated versions, and added release notes.

* Added note about the update of the AWS Java SDK
2018-04-30 13:18:41 -07:00
Sahil Palvia
a53473d536 Refactoring the Worker to make it manageable (#300)
* Reformatting the constructors to be together in the Worker class.

* Using lombok annotations to replace setters in the Worker.Builder.

* Deprecating all the public constructors for the Worker class. Recommending to use the Worker.Builder to create the Worker object.

* Including annotation usage for leaseManager in  the Worker.Builder

* Adding capability to support Immutable clients by the Worker and Worker.Builder

* Adding annotation support for WorkerStateChangeListener.
2018-03-05 10:25:41 -08:00
Walid Baruni
523cc0e2cc Fix preparing a checkpoint at SHARD_END (#301)
Fix IllegalArgumentException: Sequence number must be numeric, when preparing a checkpoint at SHARD_END
2018-02-27 08:49:20 -08:00
nyo
24916ba552 Created listener for worker state change (#291)
* Created listener for worker state change
#275
2018-02-27 06:54:16 -08:00
Henri Yandell
9e3399405b Adding standard files (#302)
* Create PULL_REQUEST_TEMPLATE.md

* Create CONTRIBUTING.md

* Create CODE_OF_CONDUCT.md

* Update CONTRIBUTING.md
2018-02-26 10:31:55 -08:00
Felipe Gasparini
6fc148740d Allow specifying a custom LeaseManager in Worker.Builder with tests (#297)
* Allow specifying a custom LeaseManager in Worker.Builder

* Added unit tests for ILeaseManager injection in Worker Builder
2018-02-14 09:03:49 -08:00
Sahil Palvia
d7de6df958 Updating to the next version, 1.9.1-SNAPSHOT. (#295) 2018-02-09 10:09:33 -08:00
Justin Pfifer
147302b398 Add a warning about ListShards and IAM Polices (#296)
* Add a warning about ListShards and IAM Polices

* Corrected some spelling errors

* Add the same warning to the changelog

Added the warning from the README.md to the CHANGELOG.md.
2018-02-06 13:53:58 -08:00
Sahil Palvia
09ec52bd16 Release 1.9.0 of the Amazon Kinesis Client for Java (#294)
* Added support for ListShards API. This API is used in place of DescribeStream API to provide more throughput during ShardSyncTask. 
  * ListShards supoorts higher call rate, which should reduce instances of throttling when attempting to synchronize the shard list.

* Updated the version of AWS Java SDK to 1.11.272.
  * Version 1.11.272 is now the minimum support versiojn of the SDK.
* Deprecated the following methods, and classes. These methods, and classes will be removed in a future release.
  * Deprecated IKinesisProxy#getStreamInfo.
  * Deprecated IKinesisProxyFactory.
  * Deprecated KinesisProxyFactory.
  * Deprecated certain KinesisProxy constructors.
2018-02-06 10:11:00 -08:00
Sahil Palvia
3ae916c5fc Introduction of Listshards API to replace DescribeStream (#293)
Use ListShards to retrieve shard information for Amazon Kinesis streams.
2018-02-06 07:35:44 -08:00
Justin Pfifer
59d40251c7
Release 1.8.10 of the Amazon Kinesis Client for Java (#288)
* Allow providing a custom IKinesisProxy implementation.
  * PR #274
* Checkpointing on a different thread should no longer emit a warning about NullMetricsScope.
  * PR #284
  * Issue #48
* Upgraded the AWS Java SDK to version 1.11.271
  * PR #287
2018-01-31 08:32:54 -08:00
Justin Pfifer
4309f23032
Upgraded Java SDK Version 1.11.271 (#287) 2018-01-29 11:41:16 -08:00
Sahil Palvia
8d6c7692cb Updating tests to fix build issues. (#286) 2018-01-26 07:16:46 -08:00
Sahil Palvia
e65e56380b Fixing issue with NullMetrics warning messages (#284)
Fixes #48 

* Fixing issue with NullMetrics warning messages when trying to checkpoint on a separate thread.

* Adding testing to validate the MetricsScope setting during checkpoiniting.
2018-01-22 10:37:46 -08:00
Sahil Palvia
71124e4055
Updating version to 1.8.10. (#283) 2018-01-16 15:58:26 -08:00
parijatsinha
222bcdaf3f Adding capability to set KinesisProxy using Worker.Builder (#274)
* Added IKinesisProxy injector in Worker.Builder to allow injecting custom proxy implementations

* Added unit tests for IKinesisProxy injection in Worker Builder

* Revert "Added unit tests for IKinesisProxy injection in Worker Builder"

This reverts commit aa944c1706.
Reverting to undo changes to import ordering.

* Added unit tests for IKinesisProxy injection in Worker Builder

Re-added unit tests after reverting changes to import ordering.

* Revert "Added unit tests for IKinesisProxy injection in Worker Builder"

This reverts commit 91e445774b.
Reverting to refactor unit tests.

* Added unit tests for Worker Builder IKinesisProxy injection validation

Refactored unit tests as per comments in the pull request.

* Added debug logs in KinesisLocalFileDataCreator

* Revert "Added debug logs in KinesisLocalFileDataCreator"

This reverts commit 1ff00d0b01.

* Edited JavaDoc for Worker Builder kinesisProxy
2018-01-15 14:31:04 -08:00
Justin Pfifer
31fd0b5811
Release 1.8.9 of the Amazon Kinesis Client for Java (#282)
* Allow disabling check for the case where a child shard has an open parent shard.
  There is a race condition where it's possible for the a parent shard
  to appear open, while having child shards. This check can now be
  disabled by setting ignoreUnexpectedChildShards in the
  KinesisClientLibConfiguration to true.
  * PR #240
  * Issue #210
* Upgraded the AWS SDK for Java to 1.11.261
  * PR #281
2018-01-15 07:52:28 -08:00
Justin Pfifer
e999c76b77
Upgraded the AWS SDK version to 1.11.261 (#281) 2018-01-12 12:01:18 -08:00
Justin Pfifer
71b3e9df13
Merge pull request #273 from pfifer/adv-version-1.8.9
Advance version to 1.8.9-SNAPSHOT
2018-01-04 09:09:40 -08:00
Pfifer, Justin
db72cc15f8 Advance version to 1.8.9-SNAPSHOT 2018-01-04 08:32:50 -08:00
Mike Watters
9074864027 [Issue 210] - Allow unexpected child shards to be ignored (#240)
Allow unexpected child shards to be ignored

now instead of always throwing an assertion if a child shard has an
open parent, consider worker configuration before doing so.  if
configured to ignore such shards, do not create leases for them during
shard sync.  this is intended to mitigate failing worker init when
processing dynamodb streams with many thousands of shards (which can
happen for tables with thousands of partitions).

this new behavior can be enabled by adding the following to a
configuration/properties file:

```
ignoreUnexpectedChildShards = true
```
2018-01-04 08:29:44 -08:00
Justin Pfifer
85d6c059c2
Merge pull request #269 from pfifer/release-1.8.8
Release 1.8.8 of the Amazon Kinesis Client for Java
2017-11-15 10:57:48 -08:00
Pfifer, Justin
47e6206e8d Release 1.8.8 of the Amazon Kinesis Client for Java
Release 1.8.8
* Fixed issues with leases losses due to `ExpiredIteratorException` in `PrefetchGetRecordsCache` and `AsynchronousFetchingStrategy`.
  PrefetchGetRecordsCache will request for a new iterator and start fetching data again.
  * PR#263
* Added warning message for long running tasks.
  * PR#259
* Handling spurious lease renewal failures gracefully.
  Added better handling of DynamoDB failures when updating leases.  These failures would occur when a request to DynamoDB appeared to fail, but was actually successful.
  * PR#247
* ShutdownTask gets retried if the previous attempt on the ShutdownTask fails.
  * PR#267
* Fix for using maxRecords from `KinesisClientLibConfiguration` in `GetRecordsCache` for fetching records.
  * PR#264
2017-11-15 10:44:49 -08:00
Sahil Palvia
3c705300b5 Adding release notes and updating the KCL version to 1.8.8. (#268) 2017-11-15 10:44:10 -08:00
Sahil Palvia
09b312028a Unit test fixes for retrying when requesting a shutdown. (#267)
* Shutdown that throws an exception will be retried.

Without this change a transient error on shutdown with reason terminate prevents
child shards from starting.

* Fixing the tests for the Shutdown fix.
2017-11-13 09:45:40 -08:00
Sahil Palvia
1abb41dbdb Correctly Send MaxRecords to SingleRecordsFetcherFactory Fixed #262
Fixes #262 

Changing the signture of SingleRecordsFetcherFactory to no longer take maxRecords as the parameter to the constructor. Changed the createRecordsFetcher signature to take maxRecords as a parameter. (#264)
2017-11-10 06:32:16 -08:00
Sahil Palvia
5c3ff2b31e Handle Expired Iterators Correctly
Fix for the lease losses in the PrefetchCache and AsyncGetRecordsStrategy caused due to ExpiredIteratorException. (#263)
2017-11-08 12:03:09 -08:00
Sahil Palvia
3de901ea93 Adding logging for long running tasks. (#259)
Allow enabling logging for long running tasks.
2017-10-25 15:38:45 -07:00
Sahil Palvia
7032ea67ec Spurious update fix (#247)
* Handle spurious lease renewal failures gracefully.

If the request to conditionally update a lease counter in DynamoDB fails, it's
considered a failure to renew the lease. This is a good thing, except if the
request failure was just because of connectivity problems. In this case the
counter *did* update in DynamoDB, but the Dynamo client retries the request
which then fails the update condition (since the lease counter no longer
matches expected value).

To handle this gracefully we opt to get the lease record from Dynamo and
examine the lease owner and counter. If it matches what we were expecting,
then we consider renewal a success.
2017-10-25 08:11:20 -07:00
Sahil Palvia
cbcc898d71 Updating version to 1.8.8-SNAPSHOT. (#258) 2017-10-25 08:09:44 -07:00
Justin Pfifer
821b0cbd0f Release Notes for 1.8.7 of the Amazon Kinesis Client Library for Java (#257)
Don't add a delay for synchronous requests to Kinesis
Removes a delay that had been added for synchronous GetRecords calls to Kinesis
2017-10-24 09:38:49 -07:00
Sahil Palvia
73426bd733 Don't Sleep for During Retrieval for the BlockingGetRecordsCache
The BlockingGetRecordsCache shouldn't sleep when retrieving records as backoff is provided in other parts of the ShardConumer.
2017-10-24 09:13:19 -07:00
Justin Pfifer
cc7e329e2f Release Note for Release 1.8.6 of the Amazon Kinesis Client for Java (#254) 2017-10-23 12:30:08 -07:00
Justin Pfifer
90d4cb78c5 Update the AWS SDK Version to 1.11.218 (#253) 2017-10-23 10:16:25 -07:00
Justin Pfifer
046e160e24 Block Fetch Thread When Retrieval Should be Paused (#252)
Block the fetching thread when the queue is considered to be full.
This ensures that the thread won't spin the CPU when it can't retrieve
more records or bytes.
2017-10-23 10:16:03 -07:00
Justin Pfifer
8ed6c81cea Revert "Shutdown that throws an exception will be retried. (#238)" (#251)
This reverts commit 44437f1361.

Reverted due to Build Failures
2017-10-19 11:40:44 -07:00
jmooreoliva
44437f1361 Shutdown that throws an exception will be retried. (#238)
Without this change a transient error on shutdown with reason terminate prevents
child shards from starting.
2017-10-18 14:16:54 -07:00
Sahil Palvia
ee3a6c24e6 Support Prefetching of Records
This adds that ability for the KCL to fetch records while the record processor is busy.  This can help smooth out delays in record process, or retrieving data from Kinesis.  Enabling this does require extra threads for background retrieval.

Settings
* dataFetchingStrategy: Which strategy to use to retrieve records.  This can be either DEFAULT or PREFETCH_CACHED
* maxCacheByteSize: Retrieval will be paused when the total number of bytes in the cache exceeds this value
* maxRecordsCount: Retrieval will be paused when the total number of records in the cache exceeds this value
* maxPendingProcessRecordsInput: Retrieval will be paused when the total number of fulfilled requests in the cache exceeds this value
2017-10-17 13:05:43 -07:00
Justin Pfifer
9720b1b249 Release 1.8.5 of the Amazon Kinesis Client for Java (#232)
* Release 1.8.5 of the Amazon Kinesis Client for Java

Release 1.8.5 (September 26, 2017)
* Only advance the shard iterator for the accepted response.  
  This fixes a race condition in the `KinesisDataFetcher` when it's being used to make asynchronous requests.  The shard iterator is now only advanced when the retriever calls `DataFetcherResult#accept()`.
  * PR #230
  * Issue #231
2017-09-26 14:31:59 -07:00
Justin Pfifer
6b25de917b Merge pull request #230 from pfifer/data-fetcher-accept
Only advance the shard iterator when we accept a result to return
2017-09-26 13:47:57 -07:00
Pfifer, Justin
4b20556f37 Only advance the shard iterator when we accept a result to return
This changes the retriever strategy to only accept the shard iterator
when we have accepted a result to return.  This is for the
asynchronous retriever where multiple threads may contend for the same
iterator slot.  This ensures only the one selected for the response will
advance the shard iterator.
2017-09-26 12:39:53 -07:00
Justin Pfifer
23c46267cf Merge pull request #228 from pfifer/release-1.8.4
Release 1.8.4 of the Amazon Kinesis Client for Java
2017-09-22 16:32:19 -07:00
Pfifer, Justin
c1df703d67 Release 1.8.4 of the Amazon Kinesis Client for Java
* Create a new completion service for each request.
  This ensures that canceled tasks are discarded.  This will prevent a cancellation exception causing issues processing records.
  * PR #227
  * Issue #226
2017-09-22 16:23:20 -07:00
Justin Pfifer
e8039b31ae Merge pull request #227 from pfifer/cancel-fix
Recreate the completion service instead of reusing them.
2017-09-22 16:18:52 -07:00