-
StackOverflow 文件
-
amazon-dynamodb 教程
-
批量操作需要了解的事項
-
如何建立 WriteRequest
private static WriteRequest getWriteRequest(EventTracker event) {
WriteRequest wreq = null;// = new WriteRequest();
if (event != null) {
Map<String, AttributeValue> attributeMap = new HashMap<String, AttributeValue>();
addAttribute(attributeMap, "event_id", event.getEventId());
addAttribute(attributeMap, "created_datetime", event.getCreatedDatetime());
addAttribute(attributeMap, "event", event.getEvent());
addAttribute(attributeMap, "event_type", event.getEventType());
addAttribute(attributeMap, "response_id", "NULL");
wreq = new WriteRequest(new PutRequest(attributeMap));
}
return wreq;
}
private static void addAttribute(Map<String, AttributeValue> item, String attributeName, String value) {
AttributeValue attributeValue = new AttributeValue(value);
item.put(attributeName, attributeValue);
}