Example usage for com.amazonaws.services.dynamodbv2.document BatchWriteItemOutcome getBatchWriteItemResult

List of usage examples for com.amazonaws.services.dynamodbv2.document BatchWriteItemOutcome getBatchWriteItemResult

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document BatchWriteItemOutcome getBatchWriteItemResult.

Prototype

public BatchWriteItemResult getBatchWriteItemResult() 

Source Link

Document

Returns a non-null low-level result returned from the server side.

Usage

From source file:org.apache.nifi.processors.aws.dynamodb.AbstractWriteDynamoDBProcessor.java

License:Apache License

/**
 * Helper method to handle unprocessed items items
 * @param session process session/*from  w  w w.j av  a2s.  c o m*/
 * @param keysToFlowFileMap map of flow db primary key to flow file
 * @param table dynamodb table
 * @param hashKeyName the hash key name
 * @param hashKeyValueType the hash key value
 * @param rangeKeyName the range key name
 * @param rangeKeyValueType range key value
 * @param outcome the write outcome
 */
protected void handleUnprocessedItems(final ProcessSession session, Map<ItemKeys, FlowFile> keysToFlowFileMap,
        final String table, final String hashKeyName, final String hashKeyValueType, final String rangeKeyName,
        final String rangeKeyValueType, BatchWriteItemOutcome outcome) {
    BatchWriteItemResult result = outcome.getBatchWriteItemResult();

    // Handle unprocessed items
    List<WriteRequest> unprocessedItems = result.getUnprocessedItems().get(table);
    if (unprocessedItems != null && unprocessedItems.size() > 0) {
        for (WriteRequest request : unprocessedItems) {
            Map<String, AttributeValue> item = getRequestItem(request);
            Object hashKeyValue = getValue(item, hashKeyName, hashKeyValueType);
            Object rangeKeyValue = getValue(item, rangeKeyName, rangeKeyValueType);

            sendUnprocessedToUnprocessedRelationship(session, keysToFlowFileMap, hashKeyValue, rangeKeyValue);
        }
    }
}