Singleton DynamoDbEnhancedAsyncClient/DynamoDbAsyncTable and versioned records
See original GitHub issueOne 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?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
@vonZeppelin I’m so sorry for the long silence here, this issue slipped through my filters. Marking for review from the team.
I’m leaning towards pushing people toward the transaction APIs where behavior is guaranteed to be safe instead of allowing people to opt-in to unsafe things.