awslabs / dynamodb-streams-kinesis-adapter

The Amazon DynamoDB Streams Adapter implements the Amazon Kinesis interface so that your application can use KCL to consume and process data from a DynamoDB stream.
Apache License 2.0
97 stars 37 forks source link

Backwards-incompatible change in 1.6.0 causes NullPointerException #57

Open staktrace opened 10 months ago

staktrace commented 10 months ago

Hi, we have some code that invokes StreamsWorkerFactory.createDynamoDbStreamsWorker like so:

StreamsWorkerFactory.createDynamoDbStreamsWorker(
      /* recordProcessorFactory = */
      transactionAuthRequestsStreamsRecordProcessorFactory,
      /* config = */
      kinesisClientLibConfiguration,
      /* streamsClient = */
      amazonDynamoDBStreamsAdapterClient,
      /* dynamoDBClient = */
      dynamoDBClient,
      /* cloudWatchClient = */
      null
)

In version 1.5.3 of this lib, this worked fine. In 1.6.0 it throws an NullPointerException with this at the top of the stack:

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "cloudWatchClient" is null
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.getMetricsFactory(Worker.java:1241)
    at com.amazonaws.services.dynamodbv2.streamsadapter.StreamsWorkerFactory.createDynamoDbStreamsWorker(StreamsWorkerFactory.java:127)

It appears that passing a null cloudWatchClient is no longer allowed, is this intentional?

staktrace commented 10 months ago

https://github.com/awslabs/amazon-kinesis-client/blob/1.14.9/src/main/java/com/amazonaws/services/kinesis/clientlibrary/lib/worker/Worker.java#L1241 is the line that is generating the exception (I believe), but this lib wasn't calling that code in 1.5.3 and does call it in 1.6.0