public class BatchGetItemRequest extends AmazonWebServiceRequest implements Serializable
BatchGetItem operation
.
The BatchGetItem operation returns the attributes of one or more items from one or more tables. You identify requested items by primary key.
A single operation can retrieve up to 1 MB of data, which can comprise as many as 100 items. BatchGetItem will return a partial result if the response size limit is exceeded, the table's provisioned throughput is exceeded, or an internal processing failure occurs. If a partial result is returned, the operation returns a value for UnprocessedKeys . You can use this value to retry the operation starting with the next item to get.
For example, if you ask to retrieve 100 items, but each individual item is 50 KB in size, the system returns 20 items (1 MB) and an appropriate UnprocessedKeys value so you can get the next page of results. If desired, your application can include its own logic to assemble the pages of results into one dataset.
If no items can be processed because of insufficient provisioned throughput on each of the tables involved in the request, BatchGetItem throws ProvisionedThroughputExceededException .
By default, BatchGetItem performs eventually consistent reads on every table in the request. If you want strongly consistent reads instead, you
can set ConsistentRead to true
for any or all tables.
In order to minimize response latency, BatchGetItem fetches items in parallel.
When designing your application, keep in mind that Amazon DynamoDB does not return attributes in any particular order. To help parse the response by item, include the primary key values for the items in your request in the AttributesToGet parameter.
If a requested item does not exist, it is not returned in the result. Requests for nonexistent items consume the minimum read capacity units according to the type of read. For more information, see Capacity Units Calculations in the Amazon DynamoDB Developer Guide.
Constructor and Description |
---|
BatchGetItemRequest()
Default constructor for a new BatchGetItemRequest object.
|
BatchGetItemRequest(Map<String,KeysAndAttributes> requestItems)
Constructs a new BatchGetItemRequest object.
|
BatchGetItemRequest(Map<String,KeysAndAttributes> requestItems,
ReturnConsumedCapacity returnConsumedCapacity)
Constructs a new BatchGetItemRequest object.
|
BatchGetItemRequest(Map<String,KeysAndAttributes> requestItems,
String returnConsumedCapacity)
Constructs a new BatchGetItemRequest object.
|
Modifier and Type | Method and Description |
---|---|
BatchGetItemRequest |
addRequestItemsEntry(String key,
KeysAndAttributes value)
A map of one or more table names and, for each table, the
corresponding primary keys for the items to retrieve.
|
BatchGetItemRequest |
clearRequestItemsEntries()
Removes all the entries added into RequestItems.
|
boolean |
equals(Object obj) |
Map<String,KeysAndAttributes> |
getRequestItems()
A map of one or more table names and, for each table, the
corresponding primary keys for the items to retrieve.
|
String |
getReturnConsumedCapacity()
If set to
TOTAL , ConsumedCapacity is included in
the response; if set to NONE (the default),
ConsumedCapacity is not included. |
int |
hashCode() |
void |
setRequestItems(Map<String,KeysAndAttributes> requestItems)
A map of one or more table names and, for each table, the
corresponding primary keys for the items to retrieve.
|
void |
setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
If set to
TOTAL , ConsumedCapacity is included in
the response; if set to NONE (the default),
ConsumedCapacity is not included. |
void |
setReturnConsumedCapacity(String returnConsumedCapacity)
If set to
TOTAL , ConsumedCapacity is included in
the response; if set to NONE (the default),
ConsumedCapacity is not included. |
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
BatchGetItemRequest |
withRequestItems(Map<String,KeysAndAttributes> requestItems)
A map of one or more table names and, for each table, the
corresponding primary keys for the items to retrieve.
|
BatchGetItemRequest |
withReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
If set to
TOTAL , ConsumedCapacity is included in
the response; if set to NONE (the default),
ConsumedCapacity is not included. |
BatchGetItemRequest |
withReturnConsumedCapacity(String returnConsumedCapacity)
If set to
TOTAL , ConsumedCapacity is included in
the response; if set to NONE (the default),
ConsumedCapacity is not included. |
copyPrivateRequestParameters, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setRequestCredentials, setRequestMetricCollector, withRequestMetricCollector
public BatchGetItemRequest()
public BatchGetItemRequest(Map<String,KeysAndAttributes> requestItems)
requestItems
- A map of one or more table names and, for each
table, the corresponding primary keys for the items to retrieve. Each
table name can be invoked only once. Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If
true
, a strongly consistent read is used; if
false
(the default), an eventually consistent read is
used.
public BatchGetItemRequest(Map<String,KeysAndAttributes> requestItems, String returnConsumedCapacity)
requestItems
- A map of one or more table names and, for each
table, the corresponding primary keys for the items to retrieve. Each
table name can be invoked only once. Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If
true
, a strongly consistent read is used; if
false
(the default), an eventually consistent read is
used.
returnConsumedCapacity
- If set to TOTAL
,
ConsumedCapacity is included in the response; if set to
NONE
(the default), ConsumedCapacity is not
included.public BatchGetItemRequest(Map<String,KeysAndAttributes> requestItems, ReturnConsumedCapacity returnConsumedCapacity)
requestItems
- A map of one or more table names and, for each
table, the corresponding primary keys for the items to retrieve. Each
table name can be invoked only once. Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If
true
, a strongly consistent read is used; if
false
(the default), an eventually consistent read is
used.
returnConsumedCapacity
- If set to TOTAL
,
ConsumedCapacity is included in the response; if set to
NONE
(the default), ConsumedCapacity is not
included.public Map<String,KeysAndAttributes> getRequestItems()
Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
Constraints:
Length: 1 - 100
Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
public void setRequestItems(Map<String,KeysAndAttributes> requestItems)
Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
Constraints:
Length: 1 - 100
requestItems
- A map of one or more table names and, for each table, the
corresponding primary keys for the items to retrieve. Each table name
can be invoked only once. Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
public BatchGetItemRequest withRequestItems(Map<String,KeysAndAttributes> requestItems)
Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 100
requestItems
- A map of one or more table names and, for each table, the
corresponding primary keys for the items to retrieve. Each table name
can be invoked only once. Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
public BatchGetItemRequest addRequestItemsEntry(String key, KeysAndAttributes value)
Each element in the map consists of the following:
Keys - An array of primary key attribute values that define specific items in the table.
AttributesToGet - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.
ConsistentRead - If true
, a strongly
consistent read is used; if false
(the default), an
eventually consistent read is used.
The method adds a new key-value pair into RequestItems parameter, and returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 100
key
- The key of the entry to be added into RequestItems.value
- The corresponding value of the entry to be added into RequestItems.public BatchGetItemRequest clearRequestItemsEntries()
Returns a reference to this object so that method calls can be chained together.
public String getReturnConsumedCapacity()
TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.
Constraints:
Allowed Values: TOTAL, NONE
TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.ReturnConsumedCapacity
public void setReturnConsumedCapacity(String returnConsumedCapacity)
TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.
Constraints:
Allowed Values: TOTAL, NONE
returnConsumedCapacity
- If set to TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.ReturnConsumedCapacity
public BatchGetItemRequest withReturnConsumedCapacity(String returnConsumedCapacity)
TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: TOTAL, NONE
returnConsumedCapacity
- If set to TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.ReturnConsumedCapacity
public void setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.
Constraints:
Allowed Values: TOTAL, NONE
returnConsumedCapacity
- If set to TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.ReturnConsumedCapacity
public BatchGetItemRequest withReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: TOTAL, NONE
returnConsumedCapacity
- If set to TOTAL
, ConsumedCapacity is included in
the response; if set to NONE
(the default),
ConsumedCapacity is not included.ReturnConsumedCapacity
public String toString()
toString
in class Object
Object.toString()
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.