All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.dynamodb.runtime.DynamodbRecorder Maven / Gradle / Ivy

package io.quarkus.dynamodb.runtime;

import io.quarkus.arc.Arc;
import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

@Recorder
public class DynamodbRecorder {

    public void configureRuntimeConfig(DynamodbConfig dynamodbConfig) {
        Arc.container().instance(DynamodbClientProducer.class).get().setConfig(dynamodbConfig);
    }

    public RuntimeValue createClient(
            BeanContainer beanContainer, ShutdownContext shutdown) {

        DynamodbClientProducer producer = beanContainer.instance(DynamodbClientProducer.class);
        shutdown.addShutdownTask(producer::destroy);
        return new RuntimeValue<>(producer.client());
    }

    public RuntimeValue createAsyncClient(
            BeanContainer beanContainer, ShutdownContext shutdown) {

        DynamodbClientProducer producer = beanContainer.instance(DynamodbClientProducer.class);
        shutdown.addShutdownTask(producer::destroy);
        return new RuntimeValue<>(producer.asyncClient());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy