Package com.amazonaws.services.dynamodbv2.model

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


            final Map<String, KeysAndAttributes> requestItems,
            final Map<String, List<Object>> resultSet,
            final DynamoDBMapperConfig config) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest()
            .withRequestMetricCollector(config.getRequestMetricCollector());
        batchGetItemRequest.setRequestItems(requestItems);
        int retries = 0;
        int noOfItemsInOriginalRequest = requestItems.size();
        do {
            if ( batchGetItemResult != null ) {
              retries++;

        if (noOfItemsInOriginalRequest == batchGetItemResult
            .getUnprocessedKeys().size()){
          pauseExponentially(retries);
          if (retries > BATCH_GET_MAX_RETRY_COUNT_ALL_KEYS) {
            throw new AmazonClientException(
                "Batch Get Item request to server hasn't received any data. Please try again later.");
          }
        }

                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here


            final Map<String, KeysAndAttributes> requestItems,
            final Map<String, List<Object>> resultSet,
            final DynamoDBMapperConfig config) {
       
        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest()
            .withRequestMetricCollector(config.getRequestMetricCollector());
        batchGetItemRequest.setRequestItems(requestItems);
        do {
            if ( batchGetItemResult != null ) {
                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

            final Map<String, KeysAndAttributes> requestItems,
            final Map<String, List<Object>> resultSet,
            final DynamoDBMapperConfig config) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest()
            .withRequestMetricCollector(config.getRequestMetricCollector());
        batchGetItemRequest.setRequestItems(requestItems);
        int retries = 0;
        int noOfItemsInOriginalRequest = requestItems.size();
        do {
            if ( batchGetItemResult != null ) {
                retries++;

                if (noOfItemsInOriginalRequest == batchGetItemResult
                        .getUnprocessedKeys().size()){
                    pauseExponentially(retries);
                    if (retries > BATCH_GET_MAX_RETRY_COUNT_ALL_KEYS) {
                        throw new AmazonClientException(
                                "Batch Get Item request to server hasn't received any data. Please try again later.");
                    }
                }

                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

    private void processBatchGetRequest(Map<String, Class<?>> classesByTableName,
                                        Map<String, KeysAndAttributes> requestItems,
                                        Map<String, List<Object>> resultSet) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest();
        batchGetItemRequest.setRequestItems(requestItems);
        do {
            if ( batchGetItemResult != null ) {
                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

            final Map<String, KeysAndAttributes> requestItems,
            final Map<String, List<Object>> resultSet,
            final DynamoDBMapperConfig config) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest()
            .withRequestMetricCollector(config.getRequestMetricCollector());
        batchGetItemRequest.setRequestItems(requestItems);
        int retries = 0;
        int noOfItemsInOriginalRequest = requestItems.size();
        do {
            if ( batchGetItemResult != null ) {
              retries++;

        if (noOfItemsInOriginalRequest == batchGetItemResult
            .getUnprocessedKeys().size()){
          pauseExponentially(retries);
          if (retries > BATCH_GET_MAX_RETRY_COUNT_ALL_KEYS) {
            throw new AmazonClientException(
                "Batch Get Item request to server hasn't received any data. Please try again later.");
          }
        }

                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

    private void processBatchGetRequest(Map<String, Class<?>> classesByTableName,
                                        Map<String, KeysAndAttributes> requestItems,
                                        Map<String, List<Object>> resultSet) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest();
        batchGetItemRequest.setRequestItems(requestItems);
        do {
            if ( batchGetItemResult != null ) {
                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

    private void processBatchGetRequest(Map<String, Class<?>> classesByTableName,
                                        Map<String, KeysAndAttributes> requestItems,
                                        Map<String, List<Object>> resultSet) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest();
        batchGetItemRequest.setRequestItems(requestItems);
        do {
            if ( batchGetItemResult != null ) {
                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

import com.fasterxml.jackson.core.JsonToken;

public class BatchGetItemRequestJsonUnmarshaller implements Unmarshaller<BatchGetItemRequest, JsonUnmarshallerContext> {

    public BatchGetItemRequest unmarshall(JsonUnmarshallerContext context) throws Exception {
        BatchGetItemRequest request = new BatchGetItemRequest();

        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.currentToken;
        if (token == null) token = context.nextToken();

       while (true) {
            if (token == null) break;
            if (token == JsonToken.FIELD_NAME || token == JsonToken.START_OBJECT) {
                if (context.testExpression("RequestItems", targetDepth)) {
                    request.setRequestItems(new MapUnmarshaller<String, KeysAndAttributes>(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance(), KeysAndAttributesJsonUnmarshaller.getInstance()).unmarshall(context));
                }
            } else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
                if (context.getCurrentDepth() <= originalDepth) break;
            }
            token = context.nextToken();
View Full Code Here

    }

  @Test
  public void vanillaBatchGetItemTest() throws Exception {
        this.vanillaBatchWriteItemTest();
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest();
        Map<String, KeysAndAttributes> requestItems = new HashMap<String, KeysAndAttributes>();

        KeysAndAttributes keysAndAttributes1 = new KeysAndAttributes();
        List<Map<String, AttributeValue>> itemKeys1 = new ArrayList<Map<String, AttributeValue>>();
        itemKeys1.add(createItemKey(hashKeyName1, new AttributeValue().withN("6")));
        keysAndAttributes1.setKeys(itemKeys1);
        List<String> attributesToGet1 = new ArrayList<String>();
        attributesToGet1.add(hashKeyName1);
        keysAndAttributes1.setAttributesToGet(attributesToGet1);

        KeysAndAttributes keysAndAttributes2 = new KeysAndAttributes();
        List<Map<String, AttributeValue>> itemKeys2 = new ArrayList<Map<String, AttributeValue>>();
        itemKeys2.add(createItemKey(hashKeyName2, new AttributeValue().withN("1")));
        keysAndAttributes2.setKeys(itemKeys2);
        List<String> attributesToGet2 = new ArrayList<String>();
        attributesToGet2.add(hashKeyName2);
        keysAndAttributes2.setAttributesToGet(attributesToGet2);
        //Test case 1: Every request has matches.
//        keys.add(new Key(new AttributeValue("4")));
//        keys.add(new Key(new AttributeValue("5")));
//        keys.add(new Key(new AttributeValue("3")));

        //Test case 2: Requests has no match.

        //Test case 3: Complicated test, some requests has matches, some doesn't.
//        keys.add(new Key(new AttributeValue("7")));
//        keys.add(new Key(new AttributeValue("4")));

        //Test case 4: Duplicated request
        //Duplicated requests return duplicated results.
//        keys.add(new Key(new AttributeValue("7")));
//        keys.add(new Key(new AttributeValue("7")));
//        keys.add(new Key(new AttributeValue("4")));
//        keys.add(new Key(new AttributeValue("4")));

        //Test case for Exception: Table doesn't exist.
//        requestItems.put("Vito's Table", keysAndAttributes);

        // Normal test
        // TODO: Multi table test failed. Need to be fixed.
        requestItems.put(tableName1, keysAndAttributes1);
        requestItems.put(tableName2, keysAndAttributes2);

        batchGetItemRequest.withRequestItems(requestItems);
    BatchGetItemResult result  = getClient().batchGetItem(batchGetItemRequest);
        junit.framework.Assert.assertNotNull("UnprocessedKeys should be empty rather than null.", result.getUnprocessedKeys());
  }
View Full Code Here

            final Map<String, KeysAndAttributes> requestItems,
            final Map<String, List<Object>> resultSet,
            final DynamoDBMapperConfig config) {

        BatchGetItemResult batchGetItemResult = null;
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest()
            .withRequestMetricCollector(config.getRequestMetricCollector());
        batchGetItemRequest.setRequestItems(requestItems);
        do {
            if ( batchGetItemResult != null ) {
                batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, List<Map<String, AttributeValue>>> responses = batchGetItemResult.getResponses();
            for ( String tableName : responses.keySet() ) {
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest

Copyright © 2018 www.massapicom. 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.