Class BatchWriteBuilder<T>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractBatchWriteBuilder<T, BatchWriteBuilder<T>>
dev.hogwai.dynamodb.simplified.builder.BatchWriteBuilder<T>
- Type Parameters:
T- the item type
Builds a batch write operation to put and delete multiple items in a single table.
Obtain via Table.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 attempts).
-
Field Summary
Fields inherited from class AbstractBatchWriteBuilder
itemsToPut, keysToDelete, returnConsumedCapacity -
Constructor Summary
ConstructorsConstructorDescriptionBatchWriteBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable<T> table, @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) Creates a newBatchWriteBuilderwith the given table and low-level client. -
Method Summary
Modifier and TypeMethodDescription@NonNull BatchWriteResultexecute()Executes the batch write operation.protected BatchWriteBuilder<T> self()Returnsthistyped asSfor fluent chaining.protected @NonNull StringReturns the DynamoDB table name.protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<T> Returns the table schema for converting items to attribute maps.Methods inherited from class AbstractBatchWriteBuilder
buildRequestItems, delete, delete, put, returnConsumedCapacity
-
Constructor Details
-
BatchWriteBuilder
public BatchWriteBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable<T> table, @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) Creates a newBatchWriteBuilderwith the given table and low-level client.- Parameters:
table- the DynamoDB tabledynamoDbClient- the low-level DynamoDB client
-
-
Method Details
-
self
Description copied from class:AbstractBatchWriteBuilderReturnsthistyped asSfor fluent chaining.- Specified by:
selfin classAbstractBatchWriteBuilder<T, BatchWriteBuilder<T>>- Returns:
- this builder
-
tableSchema
Description copied from class:AbstractBatchWriteBuilderReturns the table schema for converting items to attribute maps.- Specified by:
tableSchemain classAbstractBatchWriteBuilder<T, BatchWriteBuilder<T>>- Returns:
- the table schema
-
tableName
Description copied from class:AbstractBatchWriteBuilderReturns the DynamoDB table name.- Specified by:
tableNamein classAbstractBatchWriteBuilder<T, BatchWriteBuilder<T>>- Returns:
- the DynamoDB table name
-
execute
Executes the batch write operation.All puts and deletes added to this builder are sent in a single batch write request. Unprocessed items are automatically retried with exponential backoff (up to 3 attempts). Uses the low-level client so that unprocessed items can be retried.
- Returns:
- a
BatchWriteResultcontaining any unprocessed items - Throws:
IllegalArgumentException- if more than 25 items (puts + deletes combined) are provided
-