List of usage examples for com.amazonaws.services.dynamodbv2.document.internal InternalUtils toAttributeValues
public static AttributeValue[] toAttributeValues(Object[] values)
From source file:org.eluder.logback.ext.dynamodb.appender.DynamoDbAppender.java
License:Open Source License
@Override protected void handle(final ILoggingEvent event, final String encoded) throws Exception { Item item = Item.fromJSON(encoded).withPrimaryKey(createEventId(event)); Map<String, AttributeValue> attributes = InternalUtils.toAttributeValues(item); PutItemRequest request = new PutItemRequest(table, attributes); String errorMessage = format("Appender '%s' failed to send logging event '%s' to DynamoDB table '%s'", getName(), event, table);/*from w w w . java 2 s. c o m*/ CountDownLatch latch = new CountDownLatch(isAsyncParent() ? 0 : 1); dynamoDb.putItemAsync(request, new LoggingEventHandler<PutItemRequest, PutItemResult>(this, latch, errorMessage)); AppenderExecutors.awaitLatch(this, latch, getMaxFlushTime()); }