alessandrosimi / aws-dynamodb-nio

Aws DynamoDB Non-Blocking IO Client

GitHub

Latest release: 1.10.5.1
License: Apache 2.0

Aws DynamoDB Non-Blocking IO Client

Scala dynamoDB client built on top of Apache async http client with almost the same API provided by AWS SKD for Java(tm).

Why Non-Blocking IO?

Aws DynamoDB NIO Client compared with other clients uses Non-Blocking IO, so no threads are blocked during the call to Aws services. Other async clients use the AWS SKD for Java that is blocking while Aws DynamoDB NIO Client re-implements the SKD with Apache async http client (NIO).

Easy to use

The client is easy to use especially if you are familiar with the official AWS api.

val blockingClient = new AmazonDynamoDBClient()
val tableList: ListTablesResult = blockingClient.listTables
println(tableList.getTableNames)

val nioClient = new AmazonDynamoDBNioClient
val futureTableList: Future[ListTablesResult] = nioClient.listTables
futureTableList
  .map(tableList => tableList.getTableNames)
  .foreach(println)

The NIO client API differs from the original Amazon Api in two points: it needs an implicit execution context to run it and the setRegion(...) and setEndpoint(...) methods return a new client with the value changed.

How to get it

You can add DynamoNio client as a maven dependency for scala 2.11 ...

<dependency>
    <groupId>io.exemplary.aws</groupId>
    <artifactId>aws-dynamodb-nio_2.11</artifactId>
    <version>${aws.version}</version>
</dependency>

... or for scala 2.12 ..

<dependency>
    <groupId>io.exemplary.aws</groupId>
    <artifactId>aws-dynamodb-nio_2.12</artifactId>
    <version>${aws.version}</version>
</dependency>

The current supported AWS vesion is 1.10.5.1.

Philosophy behind

Aws DynamoDB NIO Client re-implements the AWS SKD for Java keeping the same signature except for the return type of each method that is wrapped in a Future[T].

For example the putItem(...) method changes its signature from

def putItem(PutItemRequest putItemRequest): PutItemResult;

to

def putItem(PutItemRequest putItemRequest): Future[PutItemResult];

Limitation

Aws DynamoDB NIO Client has few limitations or differences from AWS SKD for Java.

  1. It does not implement any retry logic
  2. It does not collect any metrics
  3. It does not implement any proxy logic