Until now, we have used a synchronous DynamoDB client to make requests to DynamoDB. Synchronous requests block the thread unless the operation is not performed. Due to network issues, sometimes it can be difficult for the operation to get completed quickly. In that case, we can go for asynchronous client requests so that we submit the requests and do some other work.
To get started with this recipe, you should have your workstation ready with the Eclipse IDE.
Asynchronous client is easy to use:
First, we need to instantiate the
AmazonDynamoDBAsync
class:AmazonDynamoDBAsync dynamoDBAsync = new AmazonDynamoDBAsyncClient(new ProfileCredentialsProvider());
Next, we need to create the request to be performed in an asynchronous manner. Let's say that we need to delete a certain item from our product table. Then, we can create the
DeleteItemRequest,
as shown in the following code snippet:Map<String, AttributeValue> key = new...