Class AsyncCrossTableBatchWriteBuilder
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractCrossTableBatchWriteBuilder<AsyncCrossTableBatchWriteBuilder>
dev.hogwai.dynamodb.simplified.async.AsyncCrossTableBatchWriteBuilder
public class AsyncCrossTableBatchWriteBuilder
extends AbstractCrossTableBatchWriteBuilder<AsyncCrossTableBatchWriteBuilder>
Builds an async cross-table batch write operation to put and delete items
across multiple tables.
Obtain via AsyncDynamoSimplifiedClient.batchWrite().
A single batch write can contain up to 25 put and delete operations combined.
Unprocessed items are automatically retried with exponential backoff (up to 3 retries).
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractCrossTableBatchWriteBuilder
AbstractCrossTableBatchWriteBuilder.Operation -
Field Summary
Fields inherited from class AbstractCrossTableBatchWriteBuilder
operations, returnConsumedCapacity -
Constructor Summary
ConstructorsConstructorDescriptionAsyncCrossTableBatchWriteBuilder(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient) Constructs a newAsyncCrossTableBatchWriteBuilder. -
Method Summary
Modifier and TypeMethodDescription@NonNull CompletableFuture<CrossTableBatchWriteResult> execute()Executes the batch write operation asynchronously.protected @NonNull StringgetTableName(@NonNull AbstractCrossTableBatchWriteBuilder.Operation operation) Extracts the DynamoDB table name from an operation's table reference.protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchWriteBuilder.Operation operation) Extracts the table schema from an operation's table reference.protected @NonNull AsyncCrossTableBatchWriteBuilderself()Returnsthistyped asSfor fluent chaining.Methods inherited from class AbstractCrossTableBatchWriteBuilder
buildKey, buildRequestItems, delete, delete, put, returnConsumedCapacity
-
Constructor Details
-
AsyncCrossTableBatchWriteBuilder
public AsyncCrossTableBatchWriteBuilder(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient) Constructs a newAsyncCrossTableBatchWriteBuilder.- Parameters:
dynamoDbAsyncClient- the low-level async DynamoDB client
-
-
Method Details
-
self
Description copied from class:AbstractCrossTableBatchWriteBuilderReturnsthistyped asSfor fluent chaining.- Specified by:
selfin classAbstractCrossTableBatchWriteBuilder<AsyncCrossTableBatchWriteBuilder>- Returns:
- this builder
-
getTableName
protected @NonNull String getTableName(@NonNull AbstractCrossTableBatchWriteBuilder.Operation operation) Description copied from class:AbstractCrossTableBatchWriteBuilderExtracts the DynamoDB table name from an operation's table reference.- Specified by:
getTableNamein classAbstractCrossTableBatchWriteBuilder<AsyncCrossTableBatchWriteBuilder>- Parameters:
operation- the operation whose table name to extract- Returns:
- the DynamoDB table name
-
getTableSchema
protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchWriteBuilder.Operation operation) Description copied from class:AbstractCrossTableBatchWriteBuilderExtracts the table schema from an operation's table reference.- Specified by:
getTableSchemain classAbstractCrossTableBatchWriteBuilder<AsyncCrossTableBatchWriteBuilder>- Parameters:
operation- the operation whose table schema to extract- Returns:
- the table schema
-
execute
Executes the batch write operation asynchronously.All puts and deletes are sent in a single batch write request. Unprocessed items are automatically retried with exponential backoff (up to 3 retries).
- Returns:
- a
CompletableFuturecontaining theCrossTableBatchWriteResult - Throws:
IllegalArgumentException- if more than 25 items (puts + deletes combined) are provided
-