Singleton DynamoDbEnhancedAsyncClient/DynamoDbAsyncTable and versioned records
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 51
Description
One way of having instances of `DynamoDbEnhancedAsyncClient` or `DynamoDbAsyncTable` in an app is to declare them as singletons and inject whenever needed. At the same time `DynamoDbEnhancedAsyncClient` and `DynamoDbAsyncTable` can be used to execute both regular `get` / `update` / `delete` as well as batch `get` / `write` operations. If an entity for which the `AsyncClient` / `AsyncTable` instances are created (with default settings) has a version attribute, an attempt to execute batch `get` / `write` operation will cause `IllegalArgumentException("A mapper extension inserted a conditionExpression in a PutItem...")` error and regular operations would work just fine. Suggested workarounds are either use a table schema without the versioned attribute or do not load `VersionedRecordExtension` extension (loaded by default).
Is it possible to make `VersionedRecordExtension` "context-aware", so that it won't insert condition expression when it's called as part of the `put item` operation? Or `DynamoDbEnhancedAsyncClient` and `DynamoDbAsyncTable` instances aren't supposed to be shared across an app and should be created closer to the place where they are used?
Contributor guide
Assessment
This issue has not been assessed yet.