Examples of BatchWriteItemRequest


Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

        if (rList.isEmpty()) {
            return Collections.emptyList();
        }
        requestItems.put(dynamoDBTableName, rList);
        BatchWriteItemResult result;
        BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest().withRequestItems(requestItems);
        try {
            result = dynamoDBClient.batchWriteItem(batchWriteItemRequest);
            return unproccessedItems(result, requestMap);
        } catch (AmazonClientException e) {
            String message = "Amazon DynamoDB Client could not perform batch request";
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

        BatchWriteItemResult result = null;
        int retries = 0;
        FailedBatch failedBatch = null;
        while (true) {
            try {
                result = db.batchWriteItem(new BatchWriteItemRequest().withRequestItems(batch));
            } catch (Exception e) {
                failedBatch = new FailedBatch();
                failedBatch.setUnprocessedItems(batch);
                failedBatch.setException(e);
                return failedBatch;
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

                if ( !writeRequestIter.hasNext() ) {
                    tableIter.remove();
                }
            }

            BatchWriteItemResult result = db.batchWriteItem(new BatchWriteItemRequest().withRequestItems(batch));

            // add any unprocessed items back into the list to process
            for ( Entry<String, List<WriteRequest>> unprocessedItem : result.getUnprocessedItems().entrySet() ) {
                if ( !requestItems.containsKey(unprocessedItem.getKey()) ) {
                    requestItems.put(unprocessedItem.getKey(), new LinkedList<WriteRequest>());
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

                    }
                }
                requestItems.put(tableWriteItems.getTableName(), writeRequests);
            }
        }
        BatchWriteItemRequest req = spec.getRequest()
            .withRequestItems(requestItems)
            .withReturnConsumedCapacity(spec.getReturnConsumedCapacity());
        BatchWriteItemResult result = client.batchWriteItem(req);
        return new BatchWriteItemOutcome(result);
    }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

  private void batchWrite(Map<String, List<WriteRequest>> items) {
    if (items == null || items.isEmpty()) {
      return;
    }
    try {
      BatchWriteItemResult result = client().batchWriteItem(new BatchWriteItemRequest().
          withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items));
      if (result == null) {
        return;
      }
      logger.debug("batchWrite() CC: {}", result.getConsumedCapacity());
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

        BatchWriteItemResult result = null;
        int retries = 0;
        FailedBatch failedBatch = null;
        while (true) {
            try {
                result = db.batchWriteItem(new BatchWriteItemRequest().withRequestItems(batch));
            } catch (Exception e) {
                failedBatch = new FailedBatch();
                failedBatch.setUnprocessedItems(batch);
                failedBatch.setException(e);
                return failedBatch;
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

    return putPointResult;
  }
 
  public BatchWritePointResult batchWritePoints(List<PutPointRequest> putPointRequests) {
    BatchWriteItemRequest batchItemRequest = new BatchWriteItemRequest();
    List<WriteRequest> writeRequests = new ArrayList<WriteRequest>();
    for (PutPointRequest putPointRequest : putPointRequests) {
      long geohash = S2Manager.generateGeohash(putPointRequest.getGeoPoint());
      long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());
      String geoJson = GeoJsonMapper.stringFromGeoObject(putPointRequest.getGeoPoint());

      PutRequest putRequest = putPointRequest.getPutRequest();
      AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
      putRequest.getItem().put(config.getHashKeyAttributeName(), hashKeyValue);
      putRequest.getItem().put(config.getRangeKeyAttributeName(), putPointRequest.getRangeKeyValue());
      AttributeValue geohashValue = new AttributeValue().withN(Long.toString(geohash));
      putRequest.getItem().put(config.getGeohashAttributeName(), geohashValue);
      AttributeValue geoJsonValue = new AttributeValue().withS(geoJson);
      putRequest.getItem().put(config.getGeoJsonAttributeName(), geoJsonValue);     
     
      WriteRequest writeRequest = new WriteRequest(putRequest);
      writeRequests.add(writeRequest);
    }
    Map<String, List<WriteRequest>> requestItems = new HashMap<String, List<WriteRequest>>();
    requestItems.put(config.getTableName(), writeRequests);
    batchItemRequest.setRequestItems(requestItems);
    BatchWriteItemResult batchWriteItemResult = config.getDynamoDBClient().batchWriteItem(batchItemRequest);
    BatchWritePointResult batchWritePointResult = new BatchWritePointResult(batchWriteItemResult);
    return batchWritePointResult;
  }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

  private void batchWrite(Map<String, List<WriteRequest>> items) {
    if (items == null || items.isEmpty()) {
      return;
    }
    try {
      BatchWriteItemResult result = client().batchWriteItem(new BatchWriteItemRequest().
          withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items));
      if (result == null) {
        return;
      }
      logger.debug("batchWrite() CC: {}", result.getConsumedCapacity());
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

        int retries = 0;
        FailedBatch failedBatch = null;
        while (true) {
            try {
                result = db.batchWriteItem(applyBatchOperationUserAgent(
                        new BatchWriteItemRequest().withRequestItems(batch)));
            } catch (Exception e) {
                failedBatch = new FailedBatch();
                failedBatch.setUnprocessedItems(batch);
                failedBatch.setException(e);
                return failedBatch;
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest

        BatchWriteItemResult result = null;
        int retries = 0;
        FailedBatch failedBatch = null;
        while (true) {
            try {
                result = db.batchWriteItem(new BatchWriteItemRequest().withRequestItems(batch));
            } catch (Exception e) {
                failedBatch = new FailedBatch();
                failedBatch.setUnprocessedItems(batch);
                failedBatch.setException(e);
                return failedBatch;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.