question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Singleton DynamoDbEnhancedAsyncClient/DynamoDbAsyncTable and versioned records

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
debora-itocommented, Jun 14, 2022

@vonZeppelin I’m so sorry for the long silence here, this issue slipped through my filters. Marking for review from the team.

0reactions
millemscommented, Jul 11, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DynamoDbEnhancedAsyncClient (AWS SDK for Java - 2.18.37)
Writes and/or modifies multiple items from one or more tables in a single atomic transaction. Method Details. table. <T> DynamoDbAsyncTable ...
Read more >
software.amazon.awssdk.enhanced.dynamodb ...
If the list is a singleton, will just return that extension * otherwise it will ... static final clreplaced Builder implements DynamoDbEnhancedAsyncClient.
Read more >
How to use Enhanced DynamoDB AWS sdk for Java v2 in ...
Download the DynamoDB local version and and follow the steps to make it run in our local or ... return DynamoDbEnhancedAsyncClient.builder()
Read more >
Introducing enhanced DynamoDB client in the AWS SDK for ...
In the case of 'iterable' results, the asynchronous version of the enhanced client will return a Publisher that your application can subscribe ...
Read more >
DynamoDBAttribute with DynamoDbEnhancedAsyncClient ...
builder().build()).build();. Table: DynamoDbAsyncTable<TableEntity> table = dynamoDbAsyncClient.table(tableName, TableSchema.fromBean( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found