Class AsyncCrossTableBatchGetBuilder
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractCrossTableBatchGetBuilder<AsyncCrossTableBatchGetBuilder>
dev.hogwai.dynamodb.simplified.async.AsyncCrossTableBatchGetBuilder
public class AsyncCrossTableBatchGetBuilder
extends AbstractCrossTableBatchGetBuilder<AsyncCrossTableBatchGetBuilder>
Builds an async cross-table batch get operation to retrieve items from multiple tables.
Obtain via AsyncDynamoSimplifiedClient.batchGet().
Uses the low-level DynamoDbAsyncClient.batchGetItem(BatchGetItemRequest)
which returns a CompletableFuture, avoiding the reactive publisher model.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractCrossTableBatchGetBuilder
AbstractCrossTableBatchGetBuilder.Entry -
Field Summary
Fields inherited from class AbstractCrossTableBatchGetBuilder
consistentRead, entries, returnConsumedCapacity -
Constructor Summary
ConstructorsConstructorDescriptionAsyncCrossTableBatchGetBuilder(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient) Constructs a newAsyncCrossTableBatchGetBuilder. -
Method Summary
Modifier and TypeMethodDescription<T> @NonNull AsyncCrossTableBatchGetBuilderaddKey(@NonNull AsyncTable<T> table, @NonNull Object partitionKey) Adds a key to retrieve by partition key from the given async table.<T> @NonNull AsyncCrossTableBatchGetBuilderaddKey(@NonNull AsyncTable<T> table, @NonNull Object partitionKey, @NonNull Object sortKey) Adds a key to retrieve by partition and sort key from the given async table.<T> @NonNull AsyncCrossTableBatchGetBuilderaddKeys(@NonNull AsyncTable<T> table, @NonNull Collection<?> partitionKeys) Adds multiple partition keys from the given async table at once.@NonNull CompletableFuture<CrossTableBatchGetResult> execute()Executes the batch get operation asynchronously.protected @NonNull StringgetTableName(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the DynamoDB table name from an entry's table reference.protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the table schema from an entry's table reference.protected @NonNull AsyncCrossTableBatchGetBuilderself()Returnsthistyped asSfor fluent chaining.Methods inherited from class AbstractCrossTableBatchGetBuilder
buildKey, buildRequestItems, consistentRead, groupEntriesByTable, project, project, returnConsumedCapacity
-
Constructor Details
-
AsyncCrossTableBatchGetBuilder
public AsyncCrossTableBatchGetBuilder(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient) Constructs a newAsyncCrossTableBatchGetBuilder.- Parameters:
dynamoDbAsyncClient- the low-level async DynamoDB client
-
-
Method Details
-
self
Description copied from class:AbstractCrossTableBatchGetBuilderReturnsthistyped asSfor fluent chaining.- Specified by:
selfin classAbstractCrossTableBatchGetBuilder<AsyncCrossTableBatchGetBuilder>- Returns:
- this builder
-
getTableName
Description copied from class:AbstractCrossTableBatchGetBuilderExtracts the DynamoDB table name from an entry's table reference.- Specified by:
getTableNamein classAbstractCrossTableBatchGetBuilder<AsyncCrossTableBatchGetBuilder>- Parameters:
entry- the entry whose table name to extract- Returns:
- the DynamoDB table name
-
getTableSchema
protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Description copied from class:AbstractCrossTableBatchGetBuilderExtracts the table schema from an entry's table reference.- Specified by:
getTableSchemain classAbstractCrossTableBatchGetBuilder<AsyncCrossTableBatchGetBuilder>- Parameters:
entry- the entry whose table schema to extract- Returns:
- the table schema
-
addKey
public <T> @NonNull AsyncCrossTableBatchGetBuilder addKey(@NonNull AsyncTable<T> table, @NonNull Object partitionKey) Adds a key to retrieve by partition key from the given async table.- Type Parameters:
T- the item type- Parameters:
table- the typed async table to read frompartitionKey- the partition key value- Returns:
- this builder
-
addKey
public <T> @NonNull AsyncCrossTableBatchGetBuilder addKey(@NonNull AsyncTable<T> table, @NonNull Object partitionKey, @NonNull Object sortKey) Adds a key to retrieve by partition and sort key from the given async table.- Type Parameters:
T- the item type- Parameters:
table- the typed async table to read frompartitionKey- the partition key valuesortKey- the sort key value- Returns:
- this builder
-
addKeys
public <T> @NonNull AsyncCrossTableBatchGetBuilder addKeys(@NonNull AsyncTable<T> table, @NonNull Collection<?> partitionKeys) Adds multiple partition keys from the given async table at once.- Type Parameters:
T- the item type- Parameters:
table- the typed async table to read frompartitionKeys- the partition key values- Returns:
- this builder
-
execute
Executes the batch get operation asynchronously.Groups entries by table name and calls the low-level DynamoDB API.
- Returns:
- a
CompletableFuturecontaining theCrossTableBatchGetResult - Throws:
IllegalArgumentException- if more than 100 keys are provided
-