Examples of BatchGetItemOutcome


Examples of com.amazonaws.services.dynamodbv2.document.BatchGetItemOutcome

            )
            // or you can take it slow and add one at a time
            .addHashAndRangePrimaryKey(HASH_KEY_NAME, "foo", RANGE_KEY_NAME, 4)
            .addHashAndRangePrimaryKey(HASH_KEY_NAME, "foo", RANGE_KEY_NAME, 5)
            ;
        BatchGetItemOutcome outcome = dynamo.batchGetItem(
                ReturnConsumedCapacity.TOTAL, tableKeysAndAttributes);
        Map<String, List<Item>> tableItems = outcome.getTableItems();
        Assert.assertTrue(tableItems.size() == 1);
        for (Map.Entry<String, List<Item>> e: tableItems.entrySet()) {
            System.out.println("tableName: " + e.getKey());
            for (Item item: e.getValue()) {
                System.out.println("item: " + item);
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.document.BatchGetItemOutcome

                "foo",          3,
                "foo",          4,
                "foo",          5
                // etc.
            );
        BatchGetItemOutcome outcome = dynamo.batchGetItem(
                ReturnConsumedCapacity.TOTAL, tableKeysAndAttributes);
        Map<String, List<Item>> tableItems = outcome.getTableItems();
        Assert.assertTrue(tableItems.size() == 1);
        for (Map.Entry<String, List<Item>> e: tableItems.entrySet()) {
            System.out.println("tableName: " + e.getKey());
            for (Item item: e.getValue()) {
                System.out.println("item: " + item);
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.document.BatchGetItemOutcome

        }
    }

    @Test
    public void howToBatchGet_FromMultipleTables() {
        BatchGetItemOutcome outcome = dynamo.batchGetItem(
            // First table
            new TableKeysAndAttributes(TABLE_NAME)
                .withAttrbuteNames("binary", "booleanTrue", "intAttr",
                        "mapAttr", "stringSetAttr")
                // you can add a bunch of keys in one go
                .addHashAndRangePrimaryKeys(
                    HASH_KEY_NAME, RANGE_KEY_NAME,
                    "foo",          1,
                    "foo",          2,
                    "foo",          3
                    // etc.
                ),
            // Second table
            new TableKeysAndAttributes(F_UpdateItemTest.TABLE_NAME)
                .withAttrbuteNames(F_UpdateItemTest.HASH_KEY, F_UpdateItemTest.RANGE_KEY, "AddressLine1",
                        "city", "state", "zipcode", "phone")
                // you can add a bunch of keys in one go
                .addHashAndRangePrimaryKeys(
                    F_UpdateItemTest.HASH_KEY,          F_UpdateItemTest.RANGE_KEY,
                    F_UpdateItemTest.FIRST_CUSTOMER_ID, F_UpdateItemTest.ADDRESS_TYPE_HOME,
                    F_UpdateItemTest.FIRST_CUSTOMER_ID, F_UpdateItemTest.ADDRESS_TYPE_WORK
                    // etc.
                )
            );
        Map<String, List<Item>> tableItems = outcome.getTableItems();
        Assert.assertTrue(tableItems.size() == 2);
        for (Map.Entry<String, List<Item>> e: tableItems.entrySet()) {
            String tableName = e.getKey();
            System.out.println("tableName: " + tableName);
            for (Item item: e.getValue()) {
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.document.BatchGetItemOutcome

        do {
            if (attempts > 0) {
                // exponential backoff per DynamoDB recommendation
                Thread.sleep((1 << attempts) * 1000);
            }
            BatchGetItemOutcome outcome;
            if (unprocessed == null || unprocessed.size() > 0) {
                // handle initial request
                outcome = dynamo.batchGetItem(tableKeysAndAttributes);
            } else {
                // handle unprocessed items
                outcome = dynamo.batchGetItemUnprocessed(unprocessed);
            }
            Map<String, List<Item>> tableItems = outcome.getTableItems();
            for (Map.Entry<String, List<Item>> e : tableItems.entrySet()) {
                System.out.println("tableName: " + e.getKey());
                for (Item item : e.getValue()) {
                    System.out.println("item: " + item);
                }
                Assert.assertTrue(e.getValue().size() == 5);
            }
            unprocessed = outcome.getUnprocessedKeys();
            System.out.println("unprocessed: " + unprocessed);
        } while (unprocessed.size() > 0);
    }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.document.BatchGetItemOutcome

        }
        BatchGetItemRequest req = spec.getRequest()
                .withRequestItems(requestItems)
                .withReturnConsumedCapacity(spec.getReturnConsumedCapacity());
        BatchGetItemResult result = client.batchGetItem(req);
        return new BatchGetItemOutcome(result);
    }
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.