diff --git a/cloudwatch/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchProcessor.java b/cloudwatch/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchProcessor.java index 6337e9855..7af31dde0 100644 --- a/cloudwatch/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchProcessor.java +++ b/cloudwatch/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchProcessor.java @@ -5,12 +5,10 @@ import org.jboss.jandex.DotName; import io.quarkus.amazon.cloudwatch.runtime.CloudWatchBuildTimeConfig; -import io.quarkus.amazon.cloudwatch.runtime.CloudWatchClientProducer; import io.quarkus.amazon.cloudwatch.runtime.CloudWatchRecorder; import io.quarkus.amazon.common.deployment.*; import io.quarkus.amazon.common.deployment.spi.EventLoopGroupBuildItem; import io.quarkus.amazon.common.runtime.*; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -57,11 +55,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/cloudwatch/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(CloudWatchClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/cloudwatch/runtime/src/main/java/io/quarkus/amazon/cloudwatch/runtime/CloudWatchClientProducer.java b/cloudwatch/runtime/src/main/java/io/quarkus/amazon/cloudwatch/runtime/CloudWatchClientProducer.java deleted file mode 100644 index bda66813b..000000000 --- a/cloudwatch/runtime/src/main/java/io/quarkus/amazon/cloudwatch/runtime/CloudWatchClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.cloudwatch.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; -import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClientBuilder; -import software.amazon.awssdk.services.cloudwatch.CloudWatchClient; -import software.amazon.awssdk.services.cloudwatch.CloudWatchClientBuilder; - -@ApplicationScoped -public class CloudWatchClientProducer { - private final CloudWatchClient syncClient; - private final CloudWatchAsyncClient asyncClient; - - CloudWatchClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public CloudWatchClient client() { - if (syncClient == null) { - throw new IllegalStateException("The CloudWatchClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public CloudWatchAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The CloudWatchAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/cloudwatchlogs/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchLogsProcessor.java b/cloudwatchlogs/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchLogsProcessor.java index a48d165f6..f1d967c93 100644 --- a/cloudwatchlogs/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchLogsProcessor.java +++ b/cloudwatchlogs/deployment/src/main/java/io/quarkus/amazon/cloudwatch/deployment/CloudWatchLogsProcessor.java @@ -5,12 +5,10 @@ import org.jboss.jandex.DotName; import io.quarkus.amazon.cloudwatch.runtime.CloudWatchLogsBuildTimeConfig; -import io.quarkus.amazon.cloudwatch.runtime.CloudWatchLogsClientProducer; import io.quarkus.amazon.cloudwatch.runtime.CloudWatchLogsRecorder; import io.quarkus.amazon.common.deployment.*; import io.quarkus.amazon.common.deployment.spi.EventLoopGroupBuildItem; import io.quarkus.amazon.common.runtime.*; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -57,11 +55,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/cloudwatchlogs/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(CloudWatchLogsClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/cloudwatchlogs/runtime/src/main/java/io/quarkus/amazon/cloudwatch/runtime/CloudWatchLogsClientProducer.java b/cloudwatchlogs/runtime/src/main/java/io/quarkus/amazon/cloudwatch/runtime/CloudWatchLogsClientProducer.java deleted file mode 100644 index 9cc9f9554..000000000 --- a/cloudwatchlogs/runtime/src/main/java/io/quarkus/amazon/cloudwatch/runtime/CloudWatchLogsClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.cloudwatch.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsAsyncClient; -import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsAsyncClientBuilder; -import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient; -import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClientBuilder; - -@ApplicationScoped -public class CloudWatchLogsClientProducer { - private final CloudWatchLogsClient syncClient; - private final CloudWatchLogsAsyncClient asyncClient; - - CloudWatchLogsClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public CloudWatchLogsClient client() { - if (syncClient == null) { - throw new IllegalStateException("The CloudWatchClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public CloudWatchLogsAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The CloudWatchAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/cognito-user-pools/deployment/src/main/java/io/quarkus/amazon/cognitouserpools/deployment/CognitoUserPoolsProcessor.java b/cognito-user-pools/deployment/src/main/java/io/quarkus/amazon/cognitouserpools/deployment/CognitoUserPoolsProcessor.java index 64d471c86..49c33b909 100644 --- a/cognito-user-pools/deployment/src/main/java/io/quarkus/amazon/cognitouserpools/deployment/CognitoUserPoolsProcessor.java +++ b/cognito-user-pools/deployment/src/main/java/io/quarkus/amazon/cognitouserpools/deployment/CognitoUserPoolsProcessor.java @@ -5,7 +5,6 @@ import org.jboss.jandex.DotName; import io.quarkus.amazon.cognitouserpools.runtime.CognitoUserPoolsBuildTimeConfig; -import io.quarkus.amazon.cognitouserpools.runtime.CognitoUserPoolsClientProducer; import io.quarkus.amazon.cognitouserpools.runtime.CognitoUserPoolsRecorder; import io.quarkus.amazon.common.deployment.AbstractAmazonServiceProcessor; import io.quarkus.amazon.common.deployment.AmazonClientAsyncResultBuildItem; @@ -24,7 +23,6 @@ import io.quarkus.amazon.common.runtime.AmazonClientNettyTransportRecorder; import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/cognitoidentityprovider/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(CognitoUserPoolsClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/cognito-user-pools/runtime/src/main/java/io/quarkus/amazon/cognitouserpools/runtime/CognitoUserPoolsClientProducer.java b/cognito-user-pools/runtime/src/main/java/io/quarkus/amazon/cognitouserpools/runtime/CognitoUserPoolsClientProducer.java deleted file mode 100644 index ea3120ec7..000000000 --- a/cognito-user-pools/runtime/src/main/java/io/quarkus/amazon/cognitouserpools/runtime/CognitoUserPoolsClientProducer.java +++ /dev/null @@ -1,56 +0,0 @@ -package io.quarkus.amazon.cognitouserpools.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.cognitoidentityprovider.CognitoIdentityProviderAsyncClient; -import software.amazon.awssdk.services.cognitoidentityprovider.CognitoIdentityProviderAsyncClientBuilder; -import software.amazon.awssdk.services.cognitoidentityprovider.CognitoIdentityProviderClient; -import software.amazon.awssdk.services.cognitoidentityprovider.CognitoIdentityProviderClientBuilder; - -@ApplicationScoped -public class CognitoUserPoolsClientProducer { - private final CognitoIdentityProviderClient syncClient; - private final CognitoIdentityProviderAsyncClient asyncClient; - - CognitoUserPoolsClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public CognitoIdentityProviderClient client() { - if (syncClient == null) { - throw new IllegalStateException( - "The CognitoIdentityProviderClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public CognitoIdentityProviderAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException( - "The CognitoIdentityProviderAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java b/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java index 94c655c89..1ab242eb2 100644 --- a/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java +++ b/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java @@ -26,6 +26,7 @@ import io.quarkus.amazon.common.runtime.AsyncHttpClientConfig; import io.quarkus.amazon.common.runtime.AwsConfig; import io.quarkus.amazon.common.runtime.HasSdkBuildTimeConfig; +import io.quarkus.amazon.common.runtime.SdkAutoCloseableDestroyer; import io.quarkus.amazon.common.runtime.SdkBuildTimeConfig; import io.quarkus.amazon.common.runtime.SdkConfig; import io.quarkus.amazon.common.runtime.SyncHttpClientBuildTimeConfig; @@ -55,6 +56,10 @@ abstract public class AbstractAmazonServiceProcessor { abstract protected DotName asyncClientName(); + protected DotName presignerClientName() { + return null; + } + abstract protected String builtinInterceptorsPath(); protected void discoverClient(BeanRegistrationPhaseBuildItem beanRegistrationPhase, @@ -354,6 +359,7 @@ private void createClientBuilders( if (addOpenTelemetry) { syntheticBeans.produce(SyntheticBeanBuildItem .configure(syncClientBuilderClass) + .unremovable() .defaultBean() .setRuntimeInit() .scope(ApplicationScoped.class) @@ -361,12 +367,22 @@ private void createClientBuilders( .addInjectionPoint(ClassType.create(AwsSdkTelemetry.class)).done()); } else { syntheticBeans.produce(SyntheticBeanBuildItem.configure(syncClientBuilderClass) + .unremovable() .defaultBean() .setRuntimeInit() .scope(ApplicationScoped.class) .runtimeValue(syncClientBuilder) .done()); } + syntheticBeans.produce(SyntheticBeanBuildItem.configure(syncClientName()) + .unremovable() + .defaultBean() + .setRuntimeInit() + .scope(ApplicationScoped.class) + .createWith(recorder.build(syncClientBuilderClass)) + .addInjectionPoint(ClassType.create(syncClientBuilderClass)) + .destroyer(SdkAutoCloseableDestroyer.class) + .done()); clientSync.produce(new AmazonClientSyncResultBuildItem(configName)); } if (asyncClientBuilder != null) { @@ -375,6 +391,7 @@ private void createClientBuilders( if (addOpenTelemetry) { syntheticBeans.produce(SyntheticBeanBuildItem .configure(asyncClientBuilderClass) + .unremovable() .defaultBean() .setRuntimeInit() .scope(ApplicationScoped.class) @@ -382,23 +399,43 @@ private void createClientBuilders( .addInjectionPoint(ClassType.create(AwsSdkTelemetry.class)).done()); } else { syntheticBeans.produce(SyntheticBeanBuildItem.configure(asyncClientBuilderClass) + .unremovable() .defaultBean() .setRuntimeInit() .scope(ApplicationScoped.class) .runtimeValue(asyncClientBuilder) .done()); } + syntheticBeans.produce(SyntheticBeanBuildItem.configure(asyncClientName()) + .unremovable() + .defaultBean() + .setRuntimeInit() + .scope(ApplicationScoped.class) + .createWith(recorder.build(asyncClientBuilderClass)) + .addInjectionPoint(ClassType.create(asyncClientBuilderClass)) + .destroyer(SdkAutoCloseableDestroyer.class) + .done()); clientAsync.produce(new AmazonClientAsyncResultBuildItem(configName)); } if (presignerBuilder != null) { presignerBuilder = recorder.configurePresigner(presignerBuilder, awsConfigRuntime, sdkConfigRuntime, configName()); syntheticBeans.produce(SyntheticBeanBuildItem.configure(presignerBuilderClass) + .unremovable() .defaultBean() .setRuntimeInit() .scope(ApplicationScoped.class) .runtimeValue(presignerBuilder) .done()); + syntheticBeans.produce(SyntheticBeanBuildItem.configure(presignerClientName()) + .unremovable() + .defaultBean() + .setRuntimeInit() + .scope(ApplicationScoped.class) + .createWith(recorder.build(presignerBuilderClass)) + .addInjectionPoint(ClassType.create(presignerBuilderClass)) + .destroyer(SdkAutoCloseableDestroyer.class) + .done()); } } diff --git a/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientCommonRecorder.java b/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientCommonRecorder.java index da63feff5..2d22a5bfe 100644 --- a/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientCommonRecorder.java +++ b/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientCommonRecorder.java @@ -5,6 +5,7 @@ import java.util.Collections; import java.util.Objects; import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Function; import jakarta.enterprise.inject.UnsatisfiedResolutionException; import jakarta.enterprise.inject.spi.CDI; @@ -12,14 +13,17 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import io.quarkus.arc.SyntheticCreationalContext; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.annotations.Recorder; +import software.amazon.awssdk.awscore.AwsClient; import software.amazon.awssdk.awscore.client.builder.AwsClientBuilder; import software.amazon.awssdk.awscore.presigner.SdkPresigner; import software.amazon.awssdk.core.client.builder.SdkClientBuilder; import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; import software.amazon.awssdk.core.interceptor.ExecutionInterceptor; import software.amazon.awssdk.utils.StringUtils; +import software.amazon.awssdk.utils.builder.SdkBuilder; @Recorder public class AmazonClientCommonRecorder { @@ -122,4 +126,16 @@ private ExecutionInterceptor createInterceptor(String interceptorClassName) { return null; } } + + public Function, AwsClient> build(Class clazz) { + return new Function, AwsClient>() { + + @Override + public AwsClient apply(SyntheticCreationalContext context) { + SdkBuilder builder = (SdkBuilder) context.getInjectedReference(clazz); + + return (AwsClient) builder.build(); + } + }; + } } diff --git a/dynamodb-enhanced/deployment/src/main/java/io/quarkus/amazon/dynamodb/enhanced/deployment/DynamodbEnhancedProcessor.java b/dynamodb-enhanced/deployment/src/main/java/io/quarkus/amazon/dynamodb/enhanced/deployment/DynamodbEnhancedProcessor.java index 2a09c00d4..ec83fe878 100644 --- a/dynamodb-enhanced/deployment/src/main/java/io/quarkus/amazon/dynamodb/enhanced/deployment/DynamodbEnhancedProcessor.java +++ b/dynamodb-enhanced/deployment/src/main/java/io/quarkus/amazon/dynamodb/enhanced/deployment/DynamodbEnhancedProcessor.java @@ -26,7 +26,6 @@ import io.quarkus.amazon.dynamodb.enhanced.runtime.BeanTableSchemaSubstitutionImplementation; import io.quarkus.amazon.dynamodb.enhanced.runtime.DynamoDbEnhancedBuildTimeConfig; import io.quarkus.amazon.dynamodb.enhanced.runtime.DynamodbEnhancedClientRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.arc.processor.InjectionPointInfo; @@ -65,14 +64,6 @@ FeatureBuildItem feature() { return new FeatureBuildItem(FEATURE); } - @BuildStep - AdditionalBeanBuildItem additionalBeans() { - return AdditionalBeanBuildItem.builder() - .addBeanClasses(DynamoDbEnhancedClient.class, DynamoDbEnhancedAsyncClient.class) - .setUnremovable() - .setDefaultScope(io.quarkus.arc.processor.DotNames.APPLICATION_SCOPED).build(); - } - @BuildStep void setup(CombinedIndexBuildItem combinedIndexBuildItem, DynamoDbEnhancedBuildTimeConfig buildTimeConfig, @@ -135,23 +126,24 @@ void createClientBuilders( .filter(c -> configName.equals(c.getAwsClientName())) .findFirst(); - if (syncClientRuntime != null || asyncClientRuntime != null) { + if (syncClientRuntime.isPresent() || asyncClientRuntime.isPresent()) { RuntimeValue extensions = recorder.createExtensionList(); - if (syncClientRuntime != null) { + if (syncClientRuntime.isPresent()) { syntheticBean.produce(SyntheticBeanBuildItem .configure(DynamoDbEnhancedClient.class) + .unremovable() .defaultBean() .scope(ApplicationScoped.class) .setRuntimeInit() .createWith(recorder.createDynamoDbEnhancedClient(extensions)) .addInjectionPoint(ClassType.create(DynamoDbClient.class)).done()); - } - if (asyncClientRuntime != null) { + if (asyncClientRuntime.isPresent()) { syntheticBean.produce(SyntheticBeanBuildItem .configure(DynamoDbEnhancedAsyncClient.class) + .unremovable() .defaultBean() .scope(ApplicationScoped.class) .setRuntimeInit() diff --git a/dynamodb/deployment/src/main/java/io/quarkus/amazon/dynamodb/deployment/DynamodbProcessor.java b/dynamodb/deployment/src/main/java/io/quarkus/amazon/dynamodb/deployment/DynamodbProcessor.java index 5260ff404..45259ff4f 100644 --- a/dynamodb/deployment/src/main/java/io/quarkus/amazon/dynamodb/deployment/DynamodbProcessor.java +++ b/dynamodb/deployment/src/main/java/io/quarkus/amazon/dynamodb/deployment/DynamodbProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.dynamodb.runtime.DynamodbBuildTimeConfig; -import io.quarkus.amazon.dynamodb.runtime.DynamodbClientProducer; import io.quarkus.amazon.dynamodb.runtime.DynamodbRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -72,11 +70,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/dynamodb/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(DynamodbClientProducer.class); - } - @BuildStep void runtimeInitialize(BuildProducer producer) { // This class triggers initialization of FullJitterBackoffStragegy so needs to get runtime-initialized diff --git a/dynamodb/runtime/src/main/java/io/quarkus/amazon/dynamodb/runtime/DynamodbClientProducer.java b/dynamodb/runtime/src/main/java/io/quarkus/amazon/dynamodb/runtime/DynamodbClientProducer.java deleted file mode 100644 index 3ac00a4b9..000000000 --- a/dynamodb/runtime/src/main/java/io/quarkus/amazon/dynamodb/runtime/DynamodbClientProducer.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.quarkus.amazon.dynamodb.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; -import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClientBuilder; -import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder; - -@ApplicationScoped -public class DynamodbClientProducer { - - private final DynamoDbClient syncClient; - private final DynamoDbAsyncClient asyncClient; - - DynamodbClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public DynamoDbClient client() { - if (syncClient == null) { - throw new IllegalStateException("The DynamoDbClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public DynamoDbAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The DynamoDbAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/eventbridge/deployment/src/main/java/io/quarkus/amazon/eventbridge/deployment/EventBridgeProcessor.java b/eventbridge/deployment/src/main/java/io/quarkus/amazon/eventbridge/deployment/EventBridgeProcessor.java index 2b6c7d76b..4fbbb5076 100644 --- a/eventbridge/deployment/src/main/java/io/quarkus/amazon/eventbridge/deployment/EventBridgeProcessor.java +++ b/eventbridge/deployment/src/main/java/io/quarkus/amazon/eventbridge/deployment/EventBridgeProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.eventbridge.runtime.EventBridgeBuildTimeConfig; -import io.quarkus.amazon.eventbridge.runtime.EventBridgeClientProducer; import io.quarkus.amazon.eventbridge.runtime.EventBridgeRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/eventbridge/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(EventBridgeClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/eventbridge/runtime/src/main/java/io/quarkus/amazon/eventbridge/runtime/EventBridgeClientProducer.java b/eventbridge/runtime/src/main/java/io/quarkus/amazon/eventbridge/runtime/EventBridgeClientProducer.java deleted file mode 100644 index 400a00052..000000000 --- a/eventbridge/runtime/src/main/java/io/quarkus/amazon/eventbridge/runtime/EventBridgeClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.eventbridge.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.eventbridge.EventBridgeAsyncClient; -import software.amazon.awssdk.services.eventbridge.EventBridgeAsyncClientBuilder; -import software.amazon.awssdk.services.eventbridge.EventBridgeClient; -import software.amazon.awssdk.services.eventbridge.EventBridgeClientBuilder; - -@ApplicationScoped -public class EventBridgeClientProducer { - private final EventBridgeClient syncClient; - private final EventBridgeAsyncClient asyncClient; - - EventBridgeClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public EventBridgeClient client() { - if (syncClient == null) { - throw new IllegalStateException("The EventBridgeClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public EventBridgeAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The EventBridgeAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/iam/deployment/src/main/java/io/quarkus/amazon/iam/deployment/IamProcessor.java b/iam/deployment/src/main/java/io/quarkus/amazon/iam/deployment/IamProcessor.java index 5f9c21df6..ef7bd1401 100644 --- a/iam/deployment/src/main/java/io/quarkus/amazon/iam/deployment/IamProcessor.java +++ b/iam/deployment/src/main/java/io/quarkus/amazon/iam/deployment/IamProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.iam.runtime.IamBuildTimeConfig; -import io.quarkus.amazon.iam.runtime.IamClientProducer; import io.quarkus.amazon.iam.runtime.IamRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/iam/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(IamClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/iam/runtime/src/main/java/io/quarkus/amazon/iam/runtime/IamClientProducer.java b/iam/runtime/src/main/java/io/quarkus/amazon/iam/runtime/IamClientProducer.java deleted file mode 100644 index fe5117d65..000000000 --- a/iam/runtime/src/main/java/io/quarkus/amazon/iam/runtime/IamClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.iam.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.iam.IamAsyncClient; -import software.amazon.awssdk.services.iam.IamAsyncClientBuilder; -import software.amazon.awssdk.services.iam.IamClient; -import software.amazon.awssdk.services.iam.IamClientBuilder; - -@ApplicationScoped -public class IamClientProducer { - private final IamClient syncClient; - private final IamAsyncClient asyncClient; - - IamClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public IamClient client() { - if (syncClient == null) { - throw new IllegalStateException("The IamClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public IamAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The IamAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/inspector/deployment/src/main/java/io/quarkus/amazon/inspector/deployment/InspectorProcessor.java b/inspector/deployment/src/main/java/io/quarkus/amazon/inspector/deployment/InspectorProcessor.java index 1ea068932..7cf2b70b2 100644 --- a/inspector/deployment/src/main/java/io/quarkus/amazon/inspector/deployment/InspectorProcessor.java +++ b/inspector/deployment/src/main/java/io/quarkus/amazon/inspector/deployment/InspectorProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.inspector.runtime.InspectorBuildTimeConfig; -import io.quarkus.amazon.inspector.runtime.InspectorClientProducer; import io.quarkus.amazon.inspector.runtime.InspectorRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/inspector/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(InspectorClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/inspector/runtime/src/main/java/io/quarkus/amazon/inspector/runtime/InspectorClientProducer.java b/inspector/runtime/src/main/java/io/quarkus/amazon/inspector/runtime/InspectorClientProducer.java deleted file mode 100644 index e737f3c7f..000000000 --- a/inspector/runtime/src/main/java/io/quarkus/amazon/inspector/runtime/InspectorClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.inspector.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.inspector.InspectorAsyncClient; -import software.amazon.awssdk.services.inspector.InspectorAsyncClientBuilder; -import software.amazon.awssdk.services.inspector.InspectorClient; -import software.amazon.awssdk.services.inspector.InspectorClientBuilder; - -@ApplicationScoped -public class InspectorClientProducer { - private final InspectorClient syncClient; - private final InspectorAsyncClient asyncClient; - - InspectorClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public InspectorClient client() { - if (syncClient == null) { - throw new IllegalStateException("The InspectorClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public InspectorAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The InspectorAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/inspector2/deployment/src/main/java/io/quarkus/amazon/inspector2/deployment/Inspector2Processor.java b/inspector2/deployment/src/main/java/io/quarkus/amazon/inspector2/deployment/Inspector2Processor.java index 8ee1dc702..139e31b28 100644 --- a/inspector2/deployment/src/main/java/io/quarkus/amazon/inspector2/deployment/Inspector2Processor.java +++ b/inspector2/deployment/src/main/java/io/quarkus/amazon/inspector2/deployment/Inspector2Processor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.inspector2.runtime.Inspector2BuildTimeConfig; -import io.quarkus.amazon.inspector2.runtime.Inspector2ClientProducer; import io.quarkus.amazon.inspector2.runtime.Inspector2Recorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/inspector/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(Inspector2ClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/inspector2/runtime/src/main/java/io/quarkus/amazon/inspector2/runtime/Inspector2ClientProducer.java b/inspector2/runtime/src/main/java/io/quarkus/amazon/inspector2/runtime/Inspector2ClientProducer.java deleted file mode 100644 index 2f1b2f925..000000000 --- a/inspector2/runtime/src/main/java/io/quarkus/amazon/inspector2/runtime/Inspector2ClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.inspector2.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.inspector2.Inspector2AsyncClient; -import software.amazon.awssdk.services.inspector2.Inspector2AsyncClientBuilder; -import software.amazon.awssdk.services.inspector2.Inspector2Client; -import software.amazon.awssdk.services.inspector2.Inspector2ClientBuilder; - -@ApplicationScoped -public class Inspector2ClientProducer { - private final Inspector2Client syncClient; - private final Inspector2AsyncClient asyncClient; - - Inspector2ClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public Inspector2Client client() { - if (syncClient == null) { - throw new IllegalStateException("The Inspector2Client is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public Inspector2AsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The Inspector2AsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/kinesis/deployment/src/main/java/io/quarkus/amazon/kinesis/deployment/KinesisProcessor.java b/kinesis/deployment/src/main/java/io/quarkus/amazon/kinesis/deployment/KinesisProcessor.java index 42b448a60..29c8e2ff1 100644 --- a/kinesis/deployment/src/main/java/io/quarkus/amazon/kinesis/deployment/KinesisProcessor.java +++ b/kinesis/deployment/src/main/java/io/quarkus/amazon/kinesis/deployment/KinesisProcessor.java @@ -21,11 +21,8 @@ import io.quarkus.amazon.common.runtime.AmazonClientNettyTransportRecorder; import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; -import io.quarkus.amazon.kinesis.runtime.KinesisAsyncClientProducer; import io.quarkus.amazon.kinesis.runtime.KinesisBuildTimeConfig; import io.quarkus.amazon.kinesis.runtime.KinesisRecorder; -import io.quarkus.amazon.kinesis.runtime.KinesisSyncClientProducer; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -72,12 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/kinesis/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.builder().setUnremovable().addBeanClass(KinesisSyncClientProducer.class) - .addBeanClass(KinesisAsyncClientProducer.class).build(); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/kinesis/runtime/src/main/java/io/quarkus/amazon/kinesis/runtime/KinesisAsyncClientProducer.java b/kinesis/runtime/src/main/java/io/quarkus/amazon/kinesis/runtime/KinesisAsyncClientProducer.java deleted file mode 100644 index 0169c20b9..000000000 --- a/kinesis/runtime/src/main/java/io/quarkus/amazon/kinesis/runtime/KinesisAsyncClientProducer.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.quarkus.amazon.kinesis.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.kinesis.KinesisAsyncClient; -import software.amazon.awssdk.services.kinesis.KinesisAsyncClientBuilder; - -@ApplicationScoped -public class KinesisAsyncClientProducer { - private final KinesisAsyncClient asyncClient; - - KinesisAsyncClientProducer(Instance asyncClientBuilderInstance) { - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public KinesisAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The KinesisAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/kinesis/runtime/src/main/java/io/quarkus/amazon/kinesis/runtime/KinesisSyncClientProducer.java b/kinesis/runtime/src/main/java/io/quarkus/amazon/kinesis/runtime/KinesisSyncClientProducer.java deleted file mode 100644 index c129d7f1a..000000000 --- a/kinesis/runtime/src/main/java/io/quarkus/amazon/kinesis/runtime/KinesisSyncClientProducer.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.quarkus.amazon.kinesis.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.kinesis.KinesisClient; -import software.amazon.awssdk.services.kinesis.KinesisClientBuilder; - -@ApplicationScoped -public class KinesisSyncClientProducer { - private final KinesisClient syncClient; - - KinesisSyncClientProducer(Instance syncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public KinesisClient client() { - if (syncClient == null) { - throw new IllegalStateException("The KinesisClient is required but has not been detected/configured."); - } - return syncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - } -} diff --git a/kms/deployment/src/main/java/io/quarkus/amazon/kms/deployment/KmsProcessor.java b/kms/deployment/src/main/java/io/quarkus/amazon/kms/deployment/KmsProcessor.java index daa359e91..0df4713ad 100644 --- a/kms/deployment/src/main/java/io/quarkus/amazon/kms/deployment/KmsProcessor.java +++ b/kms/deployment/src/main/java/io/quarkus/amazon/kms/deployment/KmsProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.kms.runtime.KmsBuildTimeConfig; -import io.quarkus.amazon.kms.runtime.KmsClientProducer; import io.quarkus.amazon.kms.runtime.KmsRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/kms/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(KmsClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/kms/runtime/src/main/java/io/quarkus/amazon/kms/runtime/KmsClientProducer.java b/kms/runtime/src/main/java/io/quarkus/amazon/kms/runtime/KmsClientProducer.java deleted file mode 100644 index 2159154e6..000000000 --- a/kms/runtime/src/main/java/io/quarkus/amazon/kms/runtime/KmsClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.kms.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.kms.KmsAsyncClient; -import software.amazon.awssdk.services.kms.KmsAsyncClientBuilder; -import software.amazon.awssdk.services.kms.KmsClient; -import software.amazon.awssdk.services.kms.KmsClientBuilder; - -@ApplicationScoped -public class KmsClientProducer { - private final KmsClient syncClient; - private final KmsAsyncClient asyncClient; - - KmsClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public KmsClient client() { - if (syncClient == null) { - throw new IllegalStateException("The KmsClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public KmsAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The KmsAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaProcessor.java b/lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaProcessor.java index b0b78a2b8..afe4069fa 100644 --- a/lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaProcessor.java +++ b/lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaProcessor.java @@ -23,9 +23,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.lambda.runtime.LambdaBuildTimeConfig; import io.quarkus.amazon.lambda.runtime.LambdaConfig; -import io.quarkus.amazon.lambda.runtime.LambdaProducer; import io.quarkus.amazon.lambda.runtime.LambdaRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/lambda/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(LambdaProducer.class); - } - @BuildStep void setup( final BuildProducer extensionSslNativeSupport, diff --git a/lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaProducer.java b/lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaProducer.java deleted file mode 100644 index 4fd6db65c..000000000 --- a/lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaProducer.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.quarkus.amazon.lambda.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.lambda.LambdaAsyncClient; -import software.amazon.awssdk.services.lambda.LambdaAsyncClientBuilder; -import software.amazon.awssdk.services.lambda.LambdaClient; -import software.amazon.awssdk.services.lambda.LambdaClientBuilder; - -@ApplicationScoped -public class LambdaProducer { - private final LambdaClient syncClient; - private final LambdaAsyncClient asyncClient; - - LambdaProducer( - final Instance syncClientBuilderInstance, - final Instance asyncClientBuilderInstance) { - syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public LambdaClient client() { - if (syncClient == null) { - throw new IllegalStateException( - "The LambdaClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public LambdaAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException( - "The LambdaAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/s3/deployment/src/main/java/io/quarkus/amazon/s3/deployment/S3Processor.java b/s3/deployment/src/main/java/io/quarkus/amazon/s3/deployment/S3Processor.java index bed9e9aee..5687ec232 100644 --- a/s3/deployment/src/main/java/io/quarkus/amazon/s3/deployment/S3Processor.java +++ b/s3/deployment/src/main/java/io/quarkus/amazon/s3/deployment/S3Processor.java @@ -22,10 +22,8 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.s3.runtime.S3BuildTimeConfig; -import io.quarkus.amazon.s3.runtime.S3ClientProducer; import io.quarkus.amazon.s3.runtime.S3Config; import io.quarkus.amazon.s3.runtime.S3Recorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -69,13 +67,13 @@ protected DotName asyncClientName() { } @Override - protected String builtinInterceptorsPath() { - return "software/amazon/awssdk/services/s3/execution.interceptors"; + protected DotName presignerClientName() { + return DotName.createSimple(S3Presigner.class.getName()); } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(S3ClientProducer.class); + @Override + protected String builtinInterceptorsPath() { + return "software/amazon/awssdk/services/s3/execution.interceptors"; } @BuildStep diff --git a/s3/runtime/src/main/java/io/quarkus/amazon/s3/runtime/S3ClientProducer.java b/s3/runtime/src/main/java/io/quarkus/amazon/s3/runtime/S3ClientProducer.java deleted file mode 100644 index 820fa103e..000000000 --- a/s3/runtime/src/main/java/io/quarkus/amazon/s3/runtime/S3ClientProducer.java +++ /dev/null @@ -1,71 +0,0 @@ -package io.quarkus.amazon.s3.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.s3.S3AsyncClient; -import software.amazon.awssdk.services.s3.S3AsyncClientBuilder; -import software.amazon.awssdk.services.s3.S3Client; -import software.amazon.awssdk.services.s3.S3ClientBuilder; -import software.amazon.awssdk.services.s3.presigner.S3Presigner; - -@ApplicationScoped -public class S3ClientProducer { - private final S3Client syncClient; - private final S3AsyncClient asyncClient; - private final S3Presigner presigner; - - S3ClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance, - Instance presignerBuilder) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - this.presigner = presignerBuilder.isResolvable() ? presignerBuilder.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public S3Client client() { - if (syncClient == null) { - throw new IllegalStateException("The S3Client is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public S3AsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The S3AsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public S3Presigner presigner() { - if (presigner == null) { - throw new IllegalStateException("The S3Presigner is required but has not been detected/configured."); - } - return presigner; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - if (presigner != null) { - presigner.close(); - } - } -} diff --git a/secretsmanager/deployment/src/main/java/io/quarkus/amazon/secretsmanager/deployment/SecretsManagerProcessor.java b/secretsmanager/deployment/src/main/java/io/quarkus/amazon/secretsmanager/deployment/SecretsManagerProcessor.java index 6bee4c1df..b8d8530ce 100644 --- a/secretsmanager/deployment/src/main/java/io/quarkus/amazon/secretsmanager/deployment/SecretsManagerProcessor.java +++ b/secretsmanager/deployment/src/main/java/io/quarkus/amazon/secretsmanager/deployment/SecretsManagerProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.secretsmanager.runtime.SecretsManagerBuildTimeConfig; -import io.quarkus.amazon.secretsmanager.runtime.SecretsManagerClientProducer; import io.quarkus.amazon.secretsmanager.runtime.SecretsManagerRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/secretsmanager/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(SecretsManagerClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/secretsmanager/runtime/src/main/java/io/quarkus/amazon/secretsmanager/runtime/SecretsManagerClientProducer.java b/secretsmanager/runtime/src/main/java/io/quarkus/amazon/secretsmanager/runtime/SecretsManagerClientProducer.java deleted file mode 100644 index a910a6242..000000000 --- a/secretsmanager/runtime/src/main/java/io/quarkus/amazon/secretsmanager/runtime/SecretsManagerClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.secretsmanager.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerAsyncClient; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerAsyncClientBuilder; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClientBuilder; - -@ApplicationScoped -public class SecretsManagerClientProducer { - private final SecretsManagerClient syncClient; - private final SecretsManagerAsyncClient asyncClient; - - SecretsManagerClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SecretsManagerClient client() { - if (syncClient == null) { - throw new IllegalStateException("The SecretsManagerClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SecretsManagerAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The SecretsManagerAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/ses/deployment/src/main/java/io/quarkus/amazon/ses/deployment/SesProcessor.java b/ses/deployment/src/main/java/io/quarkus/amazon/ses/deployment/SesProcessor.java index daa702b20..eed34a4c0 100644 --- a/ses/deployment/src/main/java/io/quarkus/amazon/ses/deployment/SesProcessor.java +++ b/ses/deployment/src/main/java/io/quarkus/amazon/ses/deployment/SesProcessor.java @@ -22,10 +22,8 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.ses.runtime.SesBuildTimeConfig; -import io.quarkus.amazon.ses.runtime.SesClientProducer; import io.quarkus.amazon.ses.runtime.SesConfig; import io.quarkus.amazon.ses.runtime.SesRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -72,11 +70,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/ses/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(SesClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/ses/runtime/src/main/java/io/quarkus/amazon/ses/runtime/SesClientProducer.java b/ses/runtime/src/main/java/io/quarkus/amazon/ses/runtime/SesClientProducer.java deleted file mode 100644 index d89bc6f60..000000000 --- a/ses/runtime/src/main/java/io/quarkus/amazon/ses/runtime/SesClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.ses.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.ses.SesAsyncClient; -import software.amazon.awssdk.services.ses.SesAsyncClientBuilder; -import software.amazon.awssdk.services.ses.SesClient; -import software.amazon.awssdk.services.ses.SesClientBuilder; - -@ApplicationScoped -public class SesClientProducer { - private final SesClient syncClient; - private final SesAsyncClient asyncClient; - - SesClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SesClient client() { - if (syncClient == null) { - throw new IllegalStateException("The SesClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SesAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The SesAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/sfn/deployment/src/main/java/io/quarkus/amazon/sfn/deployment/SfnProcessor.java b/sfn/deployment/src/main/java/io/quarkus/amazon/sfn/deployment/SfnProcessor.java index 7f5222d59..3b90632e9 100644 --- a/sfn/deployment/src/main/java/io/quarkus/amazon/sfn/deployment/SfnProcessor.java +++ b/sfn/deployment/src/main/java/io/quarkus/amazon/sfn/deployment/SfnProcessor.java @@ -22,10 +22,8 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.sfn.runtime.SfnBuildTimeConfig; -import io.quarkus.amazon.sfn.runtime.SfnClientProducer; import io.quarkus.amazon.sfn.runtime.SfnConfig; import io.quarkus.amazon.sfn.runtime.SfnRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -72,11 +70,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/sfn/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(SfnClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/sfn/runtime/src/main/java/io/quarkus/amazon/sfn/runtime/SfnClientProducer.java b/sfn/runtime/src/main/java/io/quarkus/amazon/sfn/runtime/SfnClientProducer.java deleted file mode 100644 index f23febc12..000000000 --- a/sfn/runtime/src/main/java/io/quarkus/amazon/sfn/runtime/SfnClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.sfn.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.sfn.SfnAsyncClient; -import software.amazon.awssdk.services.sfn.SfnAsyncClientBuilder; -import software.amazon.awssdk.services.sfn.SfnClient; -import software.amazon.awssdk.services.sfn.SfnClientBuilder; - -@ApplicationScoped -public class SfnClientProducer { - private final SfnClient syncClient; - private final SfnAsyncClient asyncClient; - - SfnClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SfnClient client() { - if (syncClient == null) { - throw new IllegalStateException("The SfnClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SfnAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The SfnAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/sns/deployment/src/main/java/io/quarkus/amazon/sns/deployment/SnsProcessor.java b/sns/deployment/src/main/java/io/quarkus/amazon/sns/deployment/SnsProcessor.java index 239d6a1d0..e878153ef 100644 --- a/sns/deployment/src/main/java/io/quarkus/amazon/sns/deployment/SnsProcessor.java +++ b/sns/deployment/src/main/java/io/quarkus/amazon/sns/deployment/SnsProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.sns.runtime.SnsBuildTimeConfig; -import io.quarkus.amazon.sns.runtime.SnsClientProducer; import io.quarkus.amazon.sns.runtime.SnsRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/sns/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(SnsClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/sns/runtime/src/main/java/io/quarkus/amazon/sns/runtime/SnsClientProducer.java b/sns/runtime/src/main/java/io/quarkus/amazon/sns/runtime/SnsClientProducer.java deleted file mode 100644 index b2c5b5b55..000000000 --- a/sns/runtime/src/main/java/io/quarkus/amazon/sns/runtime/SnsClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.sns.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.sns.SnsAsyncClient; -import software.amazon.awssdk.services.sns.SnsAsyncClientBuilder; -import software.amazon.awssdk.services.sns.SnsClient; -import software.amazon.awssdk.services.sns.SnsClientBuilder; - -@ApplicationScoped -public class SnsClientProducer { - private final SnsClient syncClient; - private final SnsAsyncClient asyncClient; - - SnsClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SnsClient client() { - if (syncClient == null) { - throw new IllegalStateException("The SnsClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SnsAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The SnsAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/sqs/deployment/src/main/java/io/quarkus/amazon/sqs/deployment/SqsProcessor.java b/sqs/deployment/src/main/java/io/quarkus/amazon/sqs/deployment/SqsProcessor.java index 12efd02b1..47ccabdd7 100644 --- a/sqs/deployment/src/main/java/io/quarkus/amazon/sqs/deployment/SqsProcessor.java +++ b/sqs/deployment/src/main/java/io/quarkus/amazon/sqs/deployment/SqsProcessor.java @@ -21,10 +21,8 @@ import io.quarkus.amazon.common.runtime.AmazonClientNettyTransportRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.sqs.runtime.SqsBuildTimeConfig; -import io.quarkus.amazon.sqs.runtime.SqsClientProducer; import io.quarkus.amazon.sqs.runtime.SqsOpenTelemetryRecorder; import io.quarkus.amazon.sqs.runtime.SqsRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/sqs/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(SqsClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/sqs/runtime/src/main/java/io/quarkus/amazon/sqs/runtime/SqsClientProducer.java b/sqs/runtime/src/main/java/io/quarkus/amazon/sqs/runtime/SqsClientProducer.java deleted file mode 100644 index ea942dedd..000000000 --- a/sqs/runtime/src/main/java/io/quarkus/amazon/sqs/runtime/SqsClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.sqs.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.sqs.SqsAsyncClient; -import software.amazon.awssdk.services.sqs.SqsAsyncClientBuilder; -import software.amazon.awssdk.services.sqs.SqsClient; -import software.amazon.awssdk.services.sqs.SqsClientBuilder; - -@ApplicationScoped -public class SqsClientProducer { - private final SqsClient syncClient; - private final SqsAsyncClient asyncClient; - - SqsClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SqsClient client() { - if (syncClient == null) { - throw new IllegalStateException("The SqsClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SqsAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The SqsAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/ssm/deployment/src/main/java/io/quarkus/amazon/ssm/deployment/SsmProcessor.java b/ssm/deployment/src/main/java/io/quarkus/amazon/ssm/deployment/SsmProcessor.java index 04ba676f5..ef25c340d 100644 --- a/ssm/deployment/src/main/java/io/quarkus/amazon/ssm/deployment/SsmProcessor.java +++ b/ssm/deployment/src/main/java/io/quarkus/amazon/ssm/deployment/SsmProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.ssm.runtime.SsmBuildTimeConfig; -import io.quarkus.amazon.ssm.runtime.SsmClientProducer; import io.quarkus.amazon.ssm.runtime.SsmRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/ssm/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(SsmClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/ssm/runtime/src/main/java/io/quarkus/amazon/ssm/runtime/SsmClientProducer.java b/ssm/runtime/src/main/java/io/quarkus/amazon/ssm/runtime/SsmClientProducer.java deleted file mode 100644 index d63ecc81b..000000000 --- a/ssm/runtime/src/main/java/io/quarkus/amazon/ssm/runtime/SsmClientProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.amazon.ssm.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.ssm.SsmAsyncClient; -import software.amazon.awssdk.services.ssm.SsmAsyncClientBuilder; -import software.amazon.awssdk.services.ssm.SsmClient; -import software.amazon.awssdk.services.ssm.SsmClientBuilder; - -@ApplicationScoped -public class SsmClientProducer { - private final SsmClient syncClient; - private final SsmAsyncClient asyncClient; - - SsmClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get().build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get().build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SsmClient client() { - if (syncClient == null) { - throw new IllegalStateException("The SsmClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public SsmAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException("The SsmAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -} diff --git a/sts/deployment/src/main/java/io/quarkus/amazon/sts/deployment/StsProcessor.java b/sts/deployment/src/main/java/io/quarkus/amazon/sts/deployment/StsProcessor.java index 526aa591c..24dbab727 100644 --- a/sts/deployment/src/main/java/io/quarkus/amazon/sts/deployment/StsProcessor.java +++ b/sts/deployment/src/main/java/io/quarkus/amazon/sts/deployment/StsProcessor.java @@ -22,9 +22,7 @@ import io.quarkus.amazon.common.runtime.AmazonClientOpenTelemetryRecorder; import io.quarkus.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder; import io.quarkus.amazon.sts.runtime.StsBuildTimeConfig; -import io.quarkus.amazon.sts.runtime.StsClientProducer; import io.quarkus.amazon.sts.runtime.StsRecorder; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -71,11 +69,6 @@ protected String builtinInterceptorsPath() { return "software/amazon/awssdk/services/sts/execution.interceptors"; } - @BuildStep - AdditionalBeanBuildItem producer() { - return AdditionalBeanBuildItem.unremovableOf(StsClientProducer.class); - } - @BuildStep void setup( BuildProducer extensionSslNativeSupport, diff --git a/sts/runtime/src/main/java/io/quarkus/amazon/sts/runtime/StsClientProducer.java b/sts/runtime/src/main/java/io/quarkus/amazon/sts/runtime/StsClientProducer.java deleted file mode 100644 index 44d232c0c..000000000 --- a/sts/runtime/src/main/java/io/quarkus/amazon/sts/runtime/StsClientProducer.java +++ /dev/null @@ -1,58 +0,0 @@ -package io.quarkus.amazon.sts.runtime; - -import jakarta.annotation.PreDestroy; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Instance; -import jakarta.enterprise.inject.Produces; - -import io.quarkus.arc.DefaultBean; -import software.amazon.awssdk.services.sts.StsAsyncClient; -import software.amazon.awssdk.services.sts.StsAsyncClientBuilder; -import software.amazon.awssdk.services.sts.StsClient; -import software.amazon.awssdk.services.sts.StsClientBuilder; - -@ApplicationScoped -public class StsClientProducer { - private final StsClient syncClient; - private final StsAsyncClient asyncClient; - - public StsClientProducer(Instance syncClientBuilderInstance, - Instance asyncClientBuilderInstance) { - this.syncClient = syncClientBuilderInstance.isResolvable() ? syncClientBuilderInstance.get() - .build() : null; - this.asyncClient = asyncClientBuilderInstance.isResolvable() ? asyncClientBuilderInstance.get() - .build() : null; - } - - @DefaultBean - @Produces - @ApplicationScoped - public StsClient client() { - if (syncClient == null) { - throw new IllegalStateException( - "The StsClient is required but has not been detected/configured."); - } - return syncClient; - } - - @DefaultBean - @Produces - @ApplicationScoped - public StsAsyncClient asyncClient() { - if (asyncClient == null) { - throw new IllegalStateException( - "The StsAsyncClient is required but has not been detected/configured."); - } - return asyncClient; - } - - @PreDestroy - public void destroy() { - if (syncClient != null) { - syncClient.close(); - } - if (asyncClient != null) { - asyncClient.close(); - } - } -}