software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient Java Examples

The following examples show how to use software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamoDBAsync.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    // Creates a default async client with credentials and regions loaded from the environment
    DynamoDbAsyncClient client = DynamoDbAsyncClient.create();
    CompletableFuture<ListTablesResponse> response = client.listTables(ListTablesRequest.builder()
                                                                                        .build());

    // Map the response to another CompletableFuture containing just the table names
    CompletableFuture<List<String>> tableNames = response.thenApply(ListTablesResponse::tableNames);
    // When future is complete (either successfully or in error) handle the response
    tableNames.whenComplete((tables, err) -> {
        try {
        	if (tables != null) {
                tables.forEach(System.out::println);
            } else {
                // Handle error
                err.printStackTrace();
            }
        } finally {
            // Lets the application shut down. Only close the client when you are completely done with it.
            client.close();
        }
    });

    tableNames.join();
}
 
Example #2
Source File: AsyncPagination.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
private static void useThirdPartySubscriber() {
    // snippet-start:[dynamodb.java2.async_pagination.async]
    System.out.println("running AutoPagination - using third party subscriber...\n");

    DynamoDbAsyncClient asyncClient = DynamoDbAsyncClient.create();
    ListTablesPublisher publisher = asyncClient.listTablesPaginator(ListTablesRequest.builder()
                                                                                     .build());

    // The Flowable class has many helper methods that work with any reactive streams compatible publisher implementation
    List<String> tables = Flowable.fromPublisher(publisher)
                                  .flatMapIterable(ListTablesResponse::tableNames)
                                  .toList()
                                  .blockingGet();
    System.out.println(tables);
    
    // snippet-end:[dynamodb.java2.async_pagination.async]
}
 
Example #3
Source File: Aws2Test.java    From java-specialagent with Apache License 2.0 6 votes vote down vote up
@Test
public void testAsyncClient(final MockTracer tracer) {
  final DynamoDbAsyncClient dbClient = buildAsyncClient();
  final CompletableFuture<CreateTableResponse> createTableResultFuture = createTableAsync(dbClient, "asyncRequest");
  try {
    final CreateTableResponse result = createTableResultFuture.get(60, TimeUnit.SECONDS);
    // The following assertion is only relevant when a local instance of dynamodb is present.
    // If a local instance of dynamodb is NOT present, an exception is thrown.
    assertEquals("asyncRequest", result.tableDescription().tableName());
  }
  catch (final Exception e) {
    logger.log(Level.WARNING, e.getMessage());
  }

  await().atMost(60, TimeUnit.SECONDS).until(TestUtil.reportedSpansSize(tracer), equalTo(1));
  final List<MockSpan> spans = tracer.finishedSpans();
  assertEquals(1, spans.size());
  assertEquals("CreateTableRequest", spans.get(0).operationName());
}
 
Example #4
Source File: AsyncBatchGetItemTest.java    From aws-sdk-java-v2 with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {

    DynamoDbAsyncClient dynamoDbClient =
        DynamoDbAsyncClient.builder()
                           .region(Region.US_WEST_2)
                           .credentialsProvider(() -> AwsBasicCredentials.create("foo", "bar"))
                           .endpointOverride(URI.create("http://localhost:" + wireMock.port()))
                           .endpointDiscoveryEnabled(false)
                           .build();
    enhancedClient = DynamoDbEnhancedAsyncClient.builder()
                                                .dynamoDbClient(dynamoDbClient)
                                                .build();
    StaticTableSchema<Record> tableSchema = StaticTableSchema.builder(Record.class)
                                                             .newItemSupplier(Record::new)
                                                             .addAttribute(Integer.class,
                                                                           a -> a.name("id")
                                                                                 .getter(Record::getId)
                                                                                 .setter(Record::setId)
                                                                                 .tags(primaryPartitionKey()))
                                                             .build();
    table = enhancedClient.table("table", tableSchema);
}
 
Example #5
Source File: DynamodbRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<AwsClientBuilder> createAsyncBuilder(DynamodbConfig config,
        RuntimeValue<SdkAsyncHttpClient.Builder> transport) {

    DynamoDbAsyncClientBuilder builder = DynamoDbAsyncClient.builder();
    builder.endpointDiscoveryEnabled(config.enableEndpointDiscovery);

    if (transport != null) {
        builder.httpClientBuilder(transport.getValue());
    }
    return new RuntimeValue<>(builder);
}
 
Example #6
Source File: DefaultDynamoDbAsyncTable.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
DefaultDynamoDbAsyncTable(DynamoDbAsyncClient dynamoDbClient,
                          DynamoDbEnhancedClientExtension extension,
                          TableSchema<T> tableSchema,
                          String tableName) {
    this.dynamoDbClient = dynamoDbClient;
    this.extension = extension;
    this.tableSchema = tableSchema;
    this.tableName = tableName;
}
 
Example #7
Source File: AsyncPagination.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
private static void useThirdPartySubscriber_Reactor() {
    System.out.println("running AutoPagination - using third party subscriber...\n");

    DynamoDbAsyncClient asyncClient = DynamoDbAsyncClient.create();
    ListTablesPublisher publisher = asyncClient.listTablesPaginator(ListTablesRequest.builder()
                                                                                     .build());

    // The Flux class has many helper methods that work with any reactive streams compatible publisher implementation
    List<String> tables = Flux.from(publisher)
                              .flatMapIterable(ListTablesResponse::tableNames)
                              .collectList()
                              .block();
    System.out.println(tables);
}
 
Example #8
Source File: KinesisSourceConfig.java    From pulsar with Apache License 2.0 5 votes vote down vote up
public DynamoDbAsyncClient buildDynamoAsyncClient(AwsCredentialProviderPlugin credPlugin) {
    DynamoDbAsyncClientBuilder builder = DynamoDbAsyncClient.builder();

    if (!this.getDynamoEndpoint().isEmpty()) {
        builder.endpointOverride(URI.create(this.getDynamoEndpoint()));
    }
    if (!this.getAwsRegion().isEmpty()) {
        builder.region(this.regionAsV2Region());
    }
    builder.credentialsProvider(credPlugin.getV2CredentialsProvider());
    return builder.build();
}
 
Example #9
Source File: LocalDynamoDb.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
DynamoDbAsyncClient createAsyncClient() {
    String endpoint = String.format("http://localhost:%d", port);
    return DynamoDbAsyncClient.builder()
                              .endpointOverride(URI.create(endpoint))
                              .region(Region.US_EAST_1)
                              .credentialsProvider(StaticCredentialsProvider.create(
                                  AwsBasicCredentials.create("dummy-key", "dummy-secret")))
                              .overrideConfiguration(o -> o.addExecutionInterceptor(new VerifyUserAgentInterceptor()))
                              .build();
}
 
Example #10
Source File: ArmeriaSdkHttpClientIntegrationTest.java    From curiostack with MIT License 5 votes vote down vote up
@BeforeEach
void setUp() {
  dynamoDbAsync =
      DynamoDbAsyncClient.builder()
          .credentialsProvider(
              StaticCredentialsProvider.create(AwsBasicCredentials.create("access", "secret")))
          .region(Region.AP_NORTHEAST_1)
          .endpointOverride(server.httpUri())
          .build();
}
 
Example #11
Source File: DefaultDynamoDbAsyncIndex.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
DefaultDynamoDbAsyncIndex(DynamoDbAsyncClient dynamoDbClient,
                          DynamoDbEnhancedClientExtension extension,
                          TableSchema<T> tableSchema,
                          String tableName,
                          String indexName) {
    this.dynamoDbClient = dynamoDbClient;
    this.extension = extension;
    this.tableSchema = tableSchema;
    this.tableName = tableName;
    this.indexName = indexName;
}
 
Example #12
Source File: DynamodbRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<DynamoDbAsyncClient> buildAsyncClient(RuntimeValue<? extends AwsClientBuilder> builder,
        BeanContainer beanContainer,
        ShutdownContext shutdown) {
    DynamodbClientProducer producer = beanContainer.instance(DynamodbClientProducer.class);
    producer.setAsyncConfiguredBuilder((DynamoDbAsyncClientBuilder) builder.getValue());
    shutdown.addShutdownTask(producer::destroy);
    return new RuntimeValue<>(producer.asyncClient());
}
 
Example #13
Source File: DynamoDBUtils.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private static CompletableFuture<Boolean> waitUntilTableActiveAsync(final DynamoDbAsyncClient dynamo,
        final String table) {
    final long startTime = System.currentTimeMillis();
    final long endTime = startTime + DEFAULT_WAIT_TIMEOUT;

    return retryAsync(() -> dynamo.describeTable(DescribeTableRequest.builder().tableName(table).build()), endTime);
}
 
Example #14
Source File: DynamoDBUtils.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public static CompletableFuture<Boolean> createTableIfNotExistsAsync(final DynamoDbAsyncClient dynamo, String table) {
    return dynamo.createTable(DynamoDBUtils.createTableRequest(table))
            .thenCompose(resp -> DynamoDBUtils.waitUntilTableActiveAsync(dynamo, table))
            .exceptionally(th -> {
                if (th.getCause() instanceof ResourceInUseException) {
                    LOG.info("Reused existing table");
                    return true;
                } else {
                    LOG.error("Failed table creation", th);
                    return false;
                }
            });
}
 
Example #15
Source File: DynamoDBLeaseRefresher.java    From amazon-kinesis-client with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 * @param table
 * @param dynamoDBClient
 * @param serializer
 * @param consistentReads
 * @param tableCreatorCallback
 * @param dynamoDbRequestTimeout
 * @param billingMode
 */
public DynamoDBLeaseRefresher(final String table, final DynamoDbAsyncClient dynamoDBClient,
                              final LeaseSerializer serializer, final boolean consistentReads,
                              @NonNull final TableCreatorCallback tableCreatorCallback, Duration dynamoDbRequestTimeout,
                              final BillingMode billingMode) {
    this.table = table;
    this.dynamoDBClient = dynamoDBClient;
    this.serializer = serializer;
    this.consistentReads = consistentReads;
    this.tableCreatorCallback = tableCreatorCallback;
    this.dynamoDbRequestTimeout = dynamoDbRequestTimeout;
    this.billingMode = billingMode;
}
 
Example #16
Source File: Aws2Test.java    From java-specialagent with Apache License 2.0 5 votes vote down vote up
private static CompletableFuture<CreateTableResponse> createTableAsync(final DynamoDbAsyncClient dbClient, final String tableName) {
  final String partitionKeyName = tableName + "Id";
  final CreateTableRequest createTableRequest = CreateTableRequest.builder()
    .tableName(tableName).keySchema(KeySchemaElement.builder().attributeName(partitionKeyName).keyType(KeyType.HASH).build())
    .attributeDefinitions(AttributeDefinition.builder().attributeName(partitionKeyName).attributeType("S").build())
    .provisionedThroughput(ProvisionedThroughput.builder().readCapacityUnits(10L).writeCapacityUnits(5L).build()).build();

  return dbClient.createTable(createTableRequest);
}
 
Example #17
Source File: Aws2Test.java    From java-specialagent with Apache License 2.0 5 votes vote down vote up
private static DynamoDbAsyncClient buildAsyncClient() {
  final AwsSessionCredentials awsCreds = AwsSessionCredentials.create("access_key_id", "secret_key_id", "session_token");
  final DynamoDbAsyncClient build = DynamoDbAsyncClient.builder()
    .endpointOverride(URI.create("http://localhost:8000"))
    .region(Region.US_WEST_2)
    .credentialsProvider(StaticCredentialsProvider.create(awsCreds))
    .overrideConfiguration(ClientOverrideConfiguration.builder()
      .apiCallTimeout(Duration.ofSeconds(1)).build())
    .build();
  return build;
}
 
Example #18
Source File: DynamoDBScheduleManager.java    From dynein with Apache License 2.0 5 votes vote down vote up
DynamoDBScheduleManager(
    int maxShardId,
    TokenManager tokenManager,
    JobSpecTransformer jobSpecTransformer,
    Clock clock,
    Metrics metrics,
    DynamoDbAsyncClient ddbClient,
    DynamoDBConfiguration ddbConfig) {
  super(maxShardId, tokenManager, jobSpecTransformer, clock, metrics);
  this.ddbClient = ddbClient;
  this.ddbConfig = ddbConfig;
}
 
Example #19
Source File: ShardSyncTaskIntegrationTest.java    From amazon-kinesis-client with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    DynamoDbAsyncClient client = DynamoDbAsyncClient.builder().region(Region.US_EAST_1).build();
    leaseRefresher =
            new DynamoDBLeaseRefresher("ShardSyncTaskIntegrationTest", client, new DynamoDBLeaseSerializer(),
                    USE_CONSISTENT_READS, TableCreatorCallback.NOOP_TABLE_CREATOR_CALLBACK);

    shardDetector = new KinesisShardDetector(kinesisClient, STREAM_NAME, 500L, 50,
            LIST_SHARDS_CACHE_ALLOWED_AGE_IN_SECONDS, MAX_CACHE_MISSES_BEFORE_RELOAD, CACHE_MISS_WARNING_MODULUS);
    hierarchicalShardSyncer = new HierarchicalShardSyncer();
}
 
Example #20
Source File: DynamoDBLeaseCoordinatorIntegrationTest.java    From amazon-kinesis-client with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws ProvisionedThroughputException, DependencyException, InvalidStateException {
    final boolean useConsistentReads = true;
    if (leaseRefresher == null) {
        DynamoDbAsyncClient dynamoDBClient = DynamoDbAsyncClient.builder()
                .credentialsProvider(DefaultCredentialsProvider.create()).build();
        leaseRefresher = new DynamoDBLeaseRefresher(TABLE_NAME, dynamoDBClient, new DynamoDBLeaseSerializer(),
                useConsistentReads, TableCreatorCallback.NOOP_TABLE_CREATOR_CALLBACK);
    }
    leaseRefresher.createLeaseTableIfNotExists(10L, 10L);

    int retryLeft = ATTEMPTS;

    while (!leaseRefresher.leaseTableExists()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // Sleep called.
        }
        retryLeft--;
        if (retryLeft == 0) {
            if (!leaseRefresher.leaseTableExists()) {
                fail("Failed to create table");
            }
        }
    }

    leaseRefresher.deleteAll();
    coordinator = new DynamoDBLeaseCoordinator(leaseRefresher, WORKER_ID, LEASE_DURATION_MILLIS,
            EPSILON_MILLIS, MAX_LEASES_FOR_WORKER, MAX_LEASES_TO_STEAL_AT_ONE_TIME, MAX_LEASE_RENEWER_THREAD_COUNT,
            INITIAL_LEASE_TABLE_READ_CAPACITY, INITIAL_LEASE_TABLE_WRITE_CAPACITY, metricsFactory);
    dynamoDBCheckpointer = new DynamoDBCheckpointer(coordinator, leaseRefresher);
    dynamoDBCheckpointer.operation(OPERATION);

    coordinator.start();
}
 
Example #21
Source File: DynamoDBLeaseManagementFactory.java    From amazon-kinesis-client with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor.
 * 
 * @param kinesisClient
 * @param streamName
 * @param dynamoDBClient
 * @param tableName
 * @param workerIdentifier
 * @param executorService
 * @param initialPositionInStream
 * @param failoverTimeMillis
 * @param epsilonMillis
 * @param maxLeasesForWorker
 * @param maxLeasesToStealAtOneTime
 * @param maxLeaseRenewalThreads
 * @param cleanupLeasesUponShardCompletion
 * @param ignoreUnexpectedChildShards
 * @param shardSyncIntervalMillis
 * @param consistentReads
 * @param listShardsBackoffTimeMillis
 * @param maxListShardsRetryAttempts
 * @param maxCacheMissesBeforeReload
 * @param listShardsCacheAllowedAgeInSeconds
 * @param cacheMissWarningModulus
 * @param initialLeaseTableReadCapacity
 * @param initialLeaseTableWriteCapacity
 * @param hierarchicalShardSyncer
 * @param tableCreatorCallback
 * @param dynamoDbRequestTimeout
 */
@Deprecated
public DynamoDBLeaseManagementFactory(final KinesisAsyncClient kinesisClient, final String streamName,
        final DynamoDbAsyncClient dynamoDBClient, final String tableName, final String workerIdentifier,
        final ExecutorService executorService, final InitialPositionInStreamExtended initialPositionInStream,
        final long failoverTimeMillis, final long epsilonMillis, final int maxLeasesForWorker,
        final int maxLeasesToStealAtOneTime, final int maxLeaseRenewalThreads,
        final boolean cleanupLeasesUponShardCompletion, final boolean ignoreUnexpectedChildShards,
        final long shardSyncIntervalMillis, final boolean consistentReads, final long listShardsBackoffTimeMillis,
        final int maxListShardsRetryAttempts, final int maxCacheMissesBeforeReload,
        final long listShardsCacheAllowedAgeInSeconds, final int cacheMissWarningModulus,
        final long initialLeaseTableReadCapacity, final long initialLeaseTableWriteCapacity,
        final HierarchicalShardSyncer hierarchicalShardSyncer, final TableCreatorCallback tableCreatorCallback,
        Duration dynamoDbRequestTimeout) {
    this(kinesisClient, streamName, dynamoDBClient, tableName, workerIdentifier, executorService,
            initialPositionInStream, failoverTimeMillis, epsilonMillis, maxLeasesForWorker,
            maxLeasesToStealAtOneTime, maxLeaseRenewalThreads, cleanupLeasesUponShardCompletion,
            ignoreUnexpectedChildShards, shardSyncIntervalMillis, consistentReads, listShardsBackoffTimeMillis,
            maxListShardsRetryAttempts, maxCacheMissesBeforeReload, listShardsCacheAllowedAgeInSeconds,
            cacheMissWarningModulus, initialLeaseTableReadCapacity, initialLeaseTableWriteCapacity,
            hierarchicalShardSyncer, tableCreatorCallback, dynamoDbRequestTimeout, BillingMode.PROVISIONED);
}
 
Example #22
Source File: DynamoDBLeaseManagementFactory.java    From amazon-kinesis-client with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor.
 *
 * @param kinesisClient
 * @param streamName
 * @param dynamoDBClient
 * @param tableName
 * @param workerIdentifier
 * @param executorService
 * @param initialPositionInStream
 * @param failoverTimeMillis
 * @param epsilonMillis
 * @param maxLeasesForWorker
 * @param maxLeasesToStealAtOneTime
 * @param maxLeaseRenewalThreads
 * @param cleanupLeasesUponShardCompletion
 * @param ignoreUnexpectedChildShards
 * @param shardSyncIntervalMillis
 * @param consistentReads
 * @param listShardsBackoffTimeMillis
 * @param maxListShardsRetryAttempts
 * @param maxCacheMissesBeforeReload
 * @param listShardsCacheAllowedAgeInSeconds
 * @param cacheMissWarningModulus
 * @param initialLeaseTableReadCapacity
 * @param initialLeaseTableWriteCapacity
 * @param hierarchicalShardSyncer
 * @param tableCreatorCallback
 */
@Deprecated
public DynamoDBLeaseManagementFactory(final KinesisAsyncClient kinesisClient, final String streamName,
        final DynamoDbAsyncClient dynamoDBClient, final String tableName, final String workerIdentifier,
        final ExecutorService executorService, final InitialPositionInStreamExtended initialPositionInStream,
        final long failoverTimeMillis, final long epsilonMillis, final int maxLeasesForWorker,
        final int maxLeasesToStealAtOneTime, final int maxLeaseRenewalThreads,
        final boolean cleanupLeasesUponShardCompletion, final boolean ignoreUnexpectedChildShards,
        final long shardSyncIntervalMillis, final boolean consistentReads, final long listShardsBackoffTimeMillis,
        final int maxListShardsRetryAttempts, final int maxCacheMissesBeforeReload,
        final long listShardsCacheAllowedAgeInSeconds, final int cacheMissWarningModulus,
        final long initialLeaseTableReadCapacity, final long initialLeaseTableWriteCapacity,
        final HierarchicalShardSyncer hierarchicalShardSyncer, final TableCreatorCallback tableCreatorCallback) {
    this(kinesisClient, streamName, dynamoDBClient, tableName, workerIdentifier, executorService,
            initialPositionInStream, failoverTimeMillis, epsilonMillis, maxLeasesForWorker,
            maxLeasesToStealAtOneTime, maxLeaseRenewalThreads, cleanupLeasesUponShardCompletion,
            ignoreUnexpectedChildShards, shardSyncIntervalMillis, consistentReads, listShardsBackoffTimeMillis,
            maxListShardsRetryAttempts, maxCacheMissesBeforeReload, listShardsCacheAllowedAgeInSeconds,
            cacheMissWarningModulus, initialLeaseTableReadCapacity, initialLeaseTableWriteCapacity,
            hierarchicalShardSyncer, tableCreatorCallback, LeaseManagementConfig.DEFAULT_REQUEST_TIMEOUT);
}
 
Example #23
Source File: DynamoDBLeaseManagementFactory.java    From amazon-kinesis-client with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor.
 *
 * @param kinesisClient
 * @param streamName
 * @param dynamoDBClient
 * @param tableName
 * @param workerIdentifier
 * @param executorService
 * @param initialPositionInStream
 * @param failoverTimeMillis
 * @param epsilonMillis
 * @param maxLeasesForWorker
 * @param maxLeasesToStealAtOneTime
 * @param maxLeaseRenewalThreads
 * @param cleanupLeasesUponShardCompletion
 * @param ignoreUnexpectedChildShards
 * @param shardSyncIntervalMillis
 * @param consistentReads
 * @param listShardsBackoffTimeMillis
 * @param maxListShardsRetryAttempts
 * @param maxCacheMissesBeforeReload
 * @param listShardsCacheAllowedAgeInSeconds
 * @param cacheMissWarningModulus
 * @param initialLeaseTableReadCapacity
 * @param initialLeaseTableWriteCapacity
 * @param hierarchicalShardSyncer
 * @param tableCreatorCallback
 * @param dynamoDbRequestTimeout
 * @param billingMode
 */
public DynamoDBLeaseManagementFactory(final KinesisAsyncClient kinesisClient, final String streamName,
        final DynamoDbAsyncClient dynamoDBClient, final String tableName, final String workerIdentifier,
        final ExecutorService executorService, final InitialPositionInStreamExtended initialPositionInStream,
        final long failoverTimeMillis, final long epsilonMillis, final int maxLeasesForWorker,
        final int maxLeasesToStealAtOneTime, final int maxLeaseRenewalThreads,
        final boolean cleanupLeasesUponShardCompletion, final boolean ignoreUnexpectedChildShards,
        final long shardSyncIntervalMillis, final boolean consistentReads, final long listShardsBackoffTimeMillis,
        final int maxListShardsRetryAttempts, final int maxCacheMissesBeforeReload,
        final long listShardsCacheAllowedAgeInSeconds, final int cacheMissWarningModulus,
        final long initialLeaseTableReadCapacity, final long initialLeaseTableWriteCapacity,
        final HierarchicalShardSyncer hierarchicalShardSyncer, final TableCreatorCallback tableCreatorCallback,
        Duration dynamoDbRequestTimeout, BillingMode billingMode) {
    this.kinesisClient = kinesisClient;
    this.streamName = streamName;
    this.dynamoDBClient = dynamoDBClient;
    this.tableName = tableName;
    this.workerIdentifier = workerIdentifier;
    this.executorService = executorService;
    this.initialPositionInStream = initialPositionInStream;
    this.failoverTimeMillis = failoverTimeMillis;
    this.epsilonMillis = epsilonMillis;
    this.maxLeasesForWorker = maxLeasesForWorker;
    this.maxLeasesToStealAtOneTime = maxLeasesToStealAtOneTime;
    this.maxLeaseRenewalThreads = maxLeaseRenewalThreads;
    this.cleanupLeasesUponShardCompletion = cleanupLeasesUponShardCompletion;
    this.ignoreUnexpectedChildShards = ignoreUnexpectedChildShards;
    this.shardSyncIntervalMillis = shardSyncIntervalMillis;
    this.consistentReads = consistentReads;
    this.listShardsBackoffTimeMillis = listShardsBackoffTimeMillis;
    this.maxListShardsRetryAttempts = maxListShardsRetryAttempts;
    this.maxCacheMissesBeforeReload = maxCacheMissesBeforeReload;
    this.listShardsCacheAllowedAgeInSeconds = listShardsCacheAllowedAgeInSeconds;
    this.cacheMissWarningModulus = cacheMissWarningModulus;
    this.initialLeaseTableReadCapacity = initialLeaseTableReadCapacity;
    this.initialLeaseTableWriteCapacity = initialLeaseTableWriteCapacity;
    this.hierarchicalShardSyncer = hierarchicalShardSyncer;
    this.tableCreatorCallback = tableCreatorCallback;
    this.dynamoDbRequestTimeout = dynamoDbRequestTimeout;
    this.billingMode = billingMode;
}
 
Example #24
Source File: DynamoDBLeaseManagementFactory.java    From amazon-kinesis-client with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor.
 *
 * <p>NOTE: This constructor is deprecated and will be removed in a future release.</p>
 *
 * @param kinesisClient
 * @param streamName
 * @param dynamoDBClient
 * @param tableName
 * @param workerIdentifier
 * @param executorService
 * @param initialPositionInStream
 * @param failoverTimeMillis
 * @param epsilonMillis
 * @param maxLeasesForWorker
 * @param maxLeasesToStealAtOneTime
 * @param maxLeaseRenewalThreads
 * @param cleanupLeasesUponShardCompletion
 * @param ignoreUnexpectedChildShards
 * @param shardSyncIntervalMillis
 * @param consistentReads
 * @param listShardsBackoffTimeMillis
 * @param maxListShardsRetryAttempts
 * @param maxCacheMissesBeforeReload
 * @param listShardsCacheAllowedAgeInSeconds
 * @param cacheMissWarningModulus
 */
@Deprecated
public DynamoDBLeaseManagementFactory(final KinesisAsyncClient kinesisClient, final String streamName,
        final DynamoDbAsyncClient dynamoDBClient, final String tableName, final String workerIdentifier,
        final ExecutorService executorService, final InitialPositionInStreamExtended initialPositionInStream,
        final long failoverTimeMillis, final long epsilonMillis, final int maxLeasesForWorker,
        final int maxLeasesToStealAtOneTime, final int maxLeaseRenewalThreads,
        final boolean cleanupLeasesUponShardCompletion, final boolean ignoreUnexpectedChildShards,
        final long shardSyncIntervalMillis, final boolean consistentReads, final long listShardsBackoffTimeMillis,
        final int maxListShardsRetryAttempts, final int maxCacheMissesBeforeReload,
        final long listShardsCacheAllowedAgeInSeconds, final int cacheMissWarningModulus) {
    this(kinesisClient, streamName, dynamoDBClient, tableName, workerIdentifier, executorService,
            initialPositionInStream, failoverTimeMillis, epsilonMillis, maxLeasesForWorker,
            maxLeasesToStealAtOneTime, maxLeaseRenewalThreads, cleanupLeasesUponShardCompletion,
            ignoreUnexpectedChildShards, shardSyncIntervalMillis, consistentReads, listShardsBackoffTimeMillis,
            maxListShardsRetryAttempts, maxCacheMissesBeforeReload, listShardsCacheAllowedAgeInSeconds,
            cacheMissWarningModulus, TableConstants.DEFAULT_INITIAL_LEASE_TABLE_READ_CAPACITY,
            TableConstants.DEFAULT_INITIAL_LEASE_TABLE_WRITE_CAPACITY);
}
 
Example #25
Source File: DefaultDynamoDbAsyncTable.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public DynamoDbAsyncClient dynamoDbClient() {
    return dynamoDbClient;
}
 
Example #26
Source File: DefaultDynamoDbEnhancedAsyncClient.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public DynamoDbAsyncClient dynamoDbAsyncClient() {
    return dynamoDbClient;
}
 
Example #27
Source File: DefaultDynamoDbEnhancedAsyncClient.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
private DefaultDynamoDbEnhancedAsyncClient(Builder builder) {
    this.dynamoDbClient = builder.dynamoDbClient == null ? DynamoDbAsyncClient.create() : builder.dynamoDbClient;
    this.extension = ExtensionResolver.resolveExtensions(builder.dynamoDbEnhancedClientExtensions);
}
 
Example #28
Source File: DefaultDynamoDbAsyncIndex.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public DynamoDbAsyncClient dynamoDbClient() {
    return dynamoDbClient;
}
 
Example #29
Source File: GetItemOperation.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public Function<GetItemRequest, CompletableFuture<GetItemResponse>> asyncServiceCall(
    DynamoDbAsyncClient dynamoDbAsyncClient) {

    return dynamoDbAsyncClient::getItem;
}
 
Example #30
Source File: QueryOperation.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public Function<QueryRequest, SdkPublisher<QueryResponse>> asyncServiceCall(DynamoDbAsyncClient dynamoDbAsyncClient) {
    return dynamoDbAsyncClient::queryPaginator;
}