Class AsyncDynamoSimplifiedClient
- All Implemented Interfaces:
AsyncDynamoSimplifiedClientInterface, AutoCloseable
Provides factory methods to create an async client and access typed AsyncTable
instances for DynamoDB table operations. Wraps a DynamoDbEnhancedAsyncClient
and a DynamoDbAsyncClient.
Thread safety: this client is safe to use from multiple threads once created.
The table() factory method may be called concurrently. Individual builders
returned by AsyncTable methods are single-use and not thread-safe.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@NonNull AsyncCrossTableBatchGetBuilderbatchGet()Returns an async cross-table batch get builder for retrieving items from multiple tables.@NonNull AsyncCrossTableBatchWriteBuilderReturns an async cross-table batch write builder for putting/deleting items across multiple tables.static @NonNull AsyncDynamoSimplifiedClientBuilderbuilder()Returns a builder for creating anAsyncDynamoSimplifiedClientwith extensions and a custom DynamoDB async client.voidclose()Closes the underlying DynamoDB async clients, releasing any network resources.static @NonNull AsyncDynamoSimplifiedClientcreate()Creates anAsyncDynamoSimplifiedClientwith default AWS credentials and region.static @NonNull AsyncDynamoSimplifiedClientcreate(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient client) Creates anAsyncDynamoSimplifiedClientwith a customDynamoDbAsyncClient.<T> @NonNull AsyncEntityTable<T> entityTable(@NonNull Class<T> entityClass) Returns anAsyncEntityTablefor the given entity class, enabling single-table design with auto-computed composite keys and discriminator filtering.@NonNull CompletableFuture<software.amazon.awssdk.services.dynamodb.model.ExecuteStatementResponse> executeStatement(@NonNull software.amazon.awssdk.services.dynamodb.model.ExecuteStatementRequest request) Executes a PartiQL statement against DynamoDB asynchronously.@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClientReturns the underlyingDynamoDbAsyncClient.@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClientReturns the underlyingDynamoDbEnhancedAsyncClient.@NonNull CompletableFuture<List<String>> Lists all DynamoDB tables asynchronously.<T> @NonNull AsyncTable<T> Returns a typedAsyncTablefor the given table name and item class.<T> @NonNull AsyncTable<T> table(@NonNull String tableName, @NonNull Class<T> itemClass, @NonNull Consumer<software.amazon.awssdk.enhanced.dynamodb.mapper.StaticTableSchema.Builder<T>> configurator) Returns a typedAsyncTablefor the given table name and item class, using aStaticTableSchemaconfigured by the provided consumer.<T> @NonNull AsyncTable<T> table(@NonNull String tableName, @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<T> schema) Returns a typedAsyncTablefor the given table name and custom schema.@NonNull AsyncTransactGetBuilderStarts building an async transactional read operation across one or more tables.@NonNull AsyncTransactWriteBuilderStarts building an async transactional write operation across one or more tables.
-
Method Details
-
create
Creates anAsyncDynamoSimplifiedClientwith default AWS credentials and region.- Returns:
- a new instance
-
create
public static @NonNull AsyncDynamoSimplifiedClient create(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient client) Creates anAsyncDynamoSimplifiedClientwith a customDynamoDbAsyncClient.- Parameters:
client- the async DynamoDB client to use- Returns:
- a new instance
-
builder
Returns a builder for creating anAsyncDynamoSimplifiedClientwith extensions and a custom DynamoDB async client.- Returns:
- a new builder instance
-
table
Returns a typedAsyncTablefor the given table name and item class.- Specified by:
tablein interfaceAsyncDynamoSimplifiedClientInterface- Type Parameters:
T- the item type- Parameters:
tableName- the name of the DynamoDB tableitemClass- the class of items stored in the table- Returns:
- an
AsyncTable<T>for the specified table
-
table
public <T> @NonNull AsyncTable<T> table(@NonNull String tableName, @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<T> schema) Returns a typedAsyncTablefor the given table name and custom schema.- Specified by:
tablein interfaceAsyncDynamoSimplifiedClientInterface- Type Parameters:
T- the item type- Parameters:
tableName- the name of the DynamoDB tableschema- the table schema defining item mapping- Returns:
- an
AsyncTable<T>for the specified table
-
table
public <T> @NonNull AsyncTable<T> table(@NonNull String tableName, @NonNull Class<T> itemClass, @NonNull Consumer<software.amazon.awssdk.enhanced.dynamodb.mapper.StaticTableSchema.Builder<T>> configurator) Returns a typedAsyncTablefor the given table name and item class, using aStaticTableSchemaconfigured by the provided consumer.This is useful when you want to define the table schema programmatically rather than using annotations.
- Specified by:
tablein interfaceAsyncDynamoSimplifiedClientInterface- Type Parameters:
T- the item type- Parameters:
tableName- the name of the DynamoDB tableitemClass- the class of items stored in the tableconfigurator- a consumer to configure theStaticTableSchema.Builder- Returns:
- an
AsyncTable<T>for the specified table
-
entityTable
Returns anAsyncEntityTablefor the given entity class, enabling single-table design with auto-computed composite keys and discriminator filtering.The entity class must be annotated with
@Entity. Key components are defined via@KeyComponentand automatically composed into the table's partition/sort keys before every put and update operation. Queries are automatically filtered by the entity's discriminator value.- Specified by:
entityTablein interfaceAsyncDynamoSimplifiedClientInterface- Type Parameters:
T- the entity type- Parameters:
entityClass- the entity class annotated with@Entity- Returns:
- an
AsyncEntityTable<T>for single-table design
-
transactGet
Starts building an async transactional read operation across one or more tables.All items are read atomically in a single all-or-nothing transaction.
- Specified by:
transactGetin interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- an
AsyncTransactGetBuilderfor configuring and executing the transaction
-
transactWrite
Starts building an async transactional write operation across one or more tables.All put, update, delete, and condition check actions are applied atomically.
- Specified by:
transactWritein interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- an
AsyncTransactWriteBuilderfor configuring and executing the transaction
-
batchGet
Returns an async cross-table batch get builder for retrieving items from multiple tables.- Specified by:
batchGetin interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- an async cross-table batch get builder
-
batchWrite
Returns an async cross-table batch write builder for putting/deleting items across multiple tables.- Specified by:
batchWritein interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- an async cross-table batch write builder
-
getEnhancedClient
public @NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient getEnhancedClient()Returns the underlyingDynamoDbEnhancedAsyncClient.- Specified by:
getEnhancedClientin interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- the enhanced async DynamoDB client
-
getDynamoDbClient
public @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient getDynamoDbClient()Returns the underlyingDynamoDbAsyncClient.- Specified by:
getDynamoDbClientin interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- the DynamoDB async client
-
listTables
Lists all DynamoDB tables asynchronously.- Specified by:
listTablesin interfaceAsyncDynamoSimplifiedClientInterface- Returns:
- a
CompletableFuturecontaining a list of table names
-
executeStatement
public @NonNull CompletableFuture<software.amazon.awssdk.services.dynamodb.model.ExecuteStatementResponse> executeStatement(@NonNull software.amazon.awssdk.services.dynamodb.model.ExecuteStatementRequest request) Executes a PartiQL statement against DynamoDB asynchronously.This is a passthrough to the underlying low-level
DynamoDbAsyncClient.executeStatement(ExecuteStatementRequest).- Specified by:
executeStatementin interfaceAsyncDynamoSimplifiedClientInterface- Parameters:
request- the PartiQL request to execute- Returns:
- a
CompletableFuturecontaining the response
-
close
public void close()Closes the underlying DynamoDB async clients, releasing any network resources.After calling this method, the client instance is no longer usable.
- Specified by:
closein interfaceAsyncDynamoSimplifiedClientInterface- Specified by:
closein interfaceAutoCloseable
-