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

Question: Is the AmazonDynamoDBStreamsAdapterClient threadsafe? #14

Closed joelittlejohn closed 4 years ago

joelittlejohn commented 7 years ago

I have an application that consumes multiple DynamoDB streams from different tables. I'd like to reuse stateless clients where I can.

Is it acceptable to create different KCL workers that use the same AmazonDynamoDBStreamsAdapterClient instance, where each worker is consuming a different table stream?

joelittlejohn commented 7 years ago

Anyone have any comment on this?

joelittlejohn commented 7 years ago

/cc @pfifer @amcp :)

agarbutt commented 5 years ago

any update on this question?

aggarwal commented 4 years ago

Yes, AmazonDynamoDBStreamsAdapterClient is thread safe. It is accessed concurrently by ProcessTask instances inside the KCL worker. There are only two instance variables in the class: internalClient and requestCache. The variable internalClient is an AWS SDK client, which is thread safe. The second variable requestCache holds a reference to a plain HashMap, but mutating methods use the synchronized keyword.