List of usage examples for com.amazonaws.services.dynamodbv2.model PutRequest setItem
public void setItem(java.util.Map<String, AttributeValue> item)
A map of attribute name to attribute values, representing the primary key of an item to be processed by PutItem
.
From source file:dynamok.sink.DynamoDbSinkTask.java
License:Apache License
private void insert(ValueSource valueSource, Schema schema, Object value, PutRequest put) { final AttributeValue attributeValue; try {/* ww w. j a va 2 s . co m*/ attributeValue = schema == null ? AttributeValueConverter.toAttributeValueSchemaless(value) : AttributeValueConverter.toAttributeValue(schema, value); } catch (DataException e) { log.error("Failed to convert record with schema={} value={}", schema, value, e); throw e; } final String topAttributeName = valueSource.topAttributeName(config); if (!topAttributeName.isEmpty()) { put.addItemEntry(topAttributeName, attributeValue); } else if (attributeValue.getM() != null) { put.setItem(attributeValue.getM()); } else { throw new ConnectException("No top attribute name configured for " + valueSource + ", and it could not be converted to Map: " + attributeValue); } }