本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest类的典型用法代码示例。如果您正苦于以下问题:Java BatchGetItemRequest类的具体用法?Java BatchGetItemRequest怎么用?Java BatchGetItemRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BatchGetItemRequest类属于com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了BatchGetItemRequest类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: batchGetItem
import com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) {
this.batchGetItemRequest = batchGetItemRequest;
Map<String, List<Map<String, AttributeValue>>> responseMap = new HashMap<String, List<Map<String, AttributeValue>>>();
List<Map<String, AttributeValue>> p = new ArrayList<Map<String, AttributeValue>>();
p.add(getAttributes());
responseMap.put("DOMAIN1", p);
Map<String, AttributeValue> keysMap = new HashMap<String, AttributeValue>();
keysMap.put("1", new AttributeValue("UNPROCESSED_KEY"));
Map<String, KeysAndAttributes> unprocessedKeys = new HashMap<String, KeysAndAttributes>();
unprocessedKeys.put("DOMAIN1", new KeysAndAttributes().withKeys(keysMap));
return new BatchGetItemResult()
.withResponses(responseMap)
.withUnprocessedKeys(unprocessedKeys);
}
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:AmazonDDBClientMock.java
示例2: batchGetDataByKeys
import com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest; //导入依赖的package包/类
private List<Map<String, AttributeValue>> batchGetDataByKeys(
final String tableName, final KeysAndAttributes keys) {
Map<String, KeysAndAttributes> requestMap = new HashMap<>();
keys.setConsistentRead(true);
requestMap.put(tableName, keys);
BatchGetItemResult result = null;
try {
result = dynamoClient.batchGetItem(new BatchGetItemRequest(
requestMap));
} catch (AmazonServiceException e) {
LOG.error(e);
throw e;
}
return result.getResponses().get(this.tableName);
}
开发者ID:awslabs,项目名称:amazon-kinesis-aggregators,代码行数:18,代码来源:DynamoQueryEngine.java
示例3: batchGetItem
import com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest; //导入依赖的package包/类
public CompletableFuture<Map<String, List<Map<String, Object>>>> batchGetItem(final BatchGetItemRequest batchGetItemRequest) {
return asyncExecutor.execute(new Callable<Map<String, List<Map<String, Object>>>>() {
@Override
public Map<String, List<Map<String, Object>>> call() throws Exception {
return dbExecutor.batchGetItem(batchGetItemRequest);
}
});
}
开发者ID:landawn,项目名称:AbacusUtil,代码行数:9,代码来源:AsyncDynamoDBExecutor.java
示例4: execute
import com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest; //导入依赖的package包/类
@Override
public void execute() {
BatchGetItemResult result = ddbClient.batchGetItem(
new BatchGetItemRequest().withRequestItems(determineBatchItems()));
Map tmp = new HashMap<>();
tmp.put(DdbConstants.BATCH_RESPONSE, result.getResponses());
tmp.put(DdbConstants.UNPROCESSED_KEYS, result.getUnprocessedKeys());
addToResults(tmp);
}
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:BatchGetItemsCommand.java
示例5: batchGet
import com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest; //导入依赖的package包/类
/**
* Reads multiple items from DynamoDB, in batch.
* @param <P> type of object
* @param kna a map of row key->data
* @param results a map of ID->ParaObject
*/
protected static <P extends ParaObject> void batchGet(Map<String, KeysAndAttributes> kna, Map<String, P> results) {
if (kna == null || kna.isEmpty() || results == null) {
return;
}
try {
BatchGetItemResult result = getClient().batchGetItem(new BatchGetItemRequest().
withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(kna));
if (result == null) {
return;
}
List<Map<String, AttributeValue>> res = result.getResponses().get(kna.keySet().iterator().next());
for (Map<String, AttributeValue> item : res) {
P obj = fromRow(item);
if (obj != null) {
results.put(obj.getId(), obj);
}
}
logger.debug("batchGet(): total {}, cc {}", res.size(), result.getConsumedCapacity());
if (result.getUnprocessedKeys() != null && !result.getUnprocessedKeys().isEmpty()) {
Thread.sleep(1000);
logger.warn("{} UNPROCESSED read requests!", result.getUnprocessedKeys().size());
batchGet(result.getUnprocessedKeys(), results);
}
} catch (Exception e) {
logger.error(null, e);
}
}
开发者ID:Erudika,项目名称:para,代码行数:37,代码来源:AWSDynamoUtils.java
示例6: batchGetItem
import com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public Map<String, List<Map<String, Object>>> batchGetItem(final BatchGetItemRequest batchGetItemRequest) {
return (Map) batchGetItem(Map.class, batchGetItemRequest);
}
开发者ID:landawn,项目名称:AbacusUtil,代码行数:5,代码来源:DynamoDBExecutor.java
注:本文中的com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论