0

I am using Vert.x and I am trying to get items from DynamoDB table, by sort key and partition key. Here is how I build the client

private static DynamoDbAsyncClient buildDynamoDBAsyncClient(final Vertx vertx) {
        return VertxSdkClient.withVertx(DynamoDbAsyncClient.builder(), vertx.getOrCreateContext())
                .build();
    }

And how I request the data.

    private List<CompletableFuture<List<Map<String, Object>>>> getOverrideMetadataRecord(Promise<OverrideMetadataEntry> promise) {
        final List<CompletableFuture<List<Map<String, Object>>>> resultList = new ArrayList<>();

                    final Map<String, KeysAndAttributes> requestItems = new HashMap<>();
                    requestItems.put(tableName, KeysAndAttributes.builder().keys(Arrays.asList(createMapKeyToGet())).build());
                    final BatchGetItemRequest batchGetItemRequest = BatchGetItemRequest.builder()
                            .requestItems(requestItems).build();
                    final CompletableFuture<List<Map<String, Object>>> futureBatchResponseData =
                            dynamoDbAsyncClient.batchGetItem(batchGetItemRequest).thenApply(this::getResponseData);
                    resultList.add(futureBatchResponseData);

                    return resultList;

    }

I don't receive any objects and then I get operation timeout. What am I missing ? thank you in advance

Nane Petrosyan
  • 553
  • 1
  • 7
  • 19
  • Does this answer your question? [Thread blocked when calling dynamoDB in vert.x app](https://stackoverflow.com/questions/71056952/thread-blocked-when-calling-dynamodb-in-vert-x-app) – Gerrit Feb 10 '22 at 08:39

1 Answers1

0

Don't post the same question twice just cause you want an answer fast.

Gerrit
  • 365
  • 1
  • 3
  • 19
  • my other question is about the thread getting blocked because of some operations. In this case, I just don't receive my data and get operation timeout from vert.x – Nane Petrosyan Feb 10 '22 at 09:04
  • Ofc you dont get any data if the request times out - its the same problem. As I already replied in your other question if gathering your dynamodb data takes several seconds process them in the background for instace by a scheduler and save them for retrival in memory or whatever suits you – Gerrit Feb 10 '22 at 10:08