Example usage for com.amazonaws.services.dynamodbv2.document.internal InternalUtils toAttributeValues

List of usage examples for com.amazonaws.services.dynamodbv2.document.internal InternalUtils toAttributeValues

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document.internal InternalUtils toAttributeValues.

Prototype

public static AttributeValue[] toAttributeValues(Object[] values) 

Source Link

Document

Converts the input array of values into an array of low level representation of those values.

Usage

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());
}