This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Upgrade to spring-boot 3, spring-cloud-aws 3 and AWS SDK 2 (#155)
* feat: Upgrade to spring-boot 3, spring-cloud-aws 3 and AWS SDK 2 BREAKING CHANGES no longer compatible to spring-cloud-aws 2 and the AWS SDK 1 * feat: health indicator refactored * fix: change env variable in the test container * fix: move property to correct path Refs: INVTECH-INVTECH-2027 * fix: move property to correct path Refs: INVTECH-INVTECH-2027
- Loading branch information
1 parent
737dba4
commit c00d64d
Showing
9 changed files
with
178 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 13 additions & 37 deletions
50
src/main/java/de/idealo/spring/stream/binder/sns/config/SnsAsyncAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,28 @@ | ||
package de.idealo.spring.stream.binder.sns.config; | ||
|
||
import static io.awspring.cloud.core.config.AmazonWebserviceClientConfigurationUtils.GLOBAL_CLIENT_CONFIGURATION_BEAN_NAME; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.beans.factory.ObjectProvider; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.amazonaws.ClientConfiguration; | ||
import com.amazonaws.auth.AWSCredentialsProvider; | ||
import com.amazonaws.services.sns.AmazonSNSAsync; | ||
import com.amazonaws.services.sns.AmazonSNSAsyncClient; | ||
import io.awspring.cloud.autoconfigure.messaging.SnsProperties; | ||
import io.awspring.cloud.context.annotation.ConditionalOnMissingAmazonClient; | ||
import io.awspring.cloud.core.config.AmazonWebserviceClientFactoryBean; | ||
import io.awspring.cloud.core.region.RegionProvider; | ||
import io.awspring.cloud.core.region.StaticRegionProvider; | ||
import io.awspring.cloud.autoconfigure.core.AwsClientBuilderConfigurer; | ||
import io.awspring.cloud.autoconfigure.core.AwsClientCustomizer; | ||
import io.awspring.cloud.autoconfigure.sns.SnsProperties; | ||
import software.amazon.awssdk.services.sns.SnsAsyncClient; | ||
import software.amazon.awssdk.services.sns.SnsAsyncClientBuilder; | ||
|
||
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnClass(AmazonSNSAsync.class) | ||
@ConditionalOnClass(SnsAsyncClient.class) | ||
public class SnsAsyncAutoConfiguration { | ||
|
||
private final AWSCredentialsProvider awsCredentialsProvider; | ||
|
||
private final RegionProvider regionProvider; | ||
|
||
private final ClientConfiguration clientConfiguration; | ||
|
||
SnsAsyncAutoConfiguration(ObjectProvider<AWSCredentialsProvider> awsCredentialsProvider, | ||
ObjectProvider<RegionProvider> regionProvider, SnsProperties properties, | ||
@Qualifier(GLOBAL_CLIENT_CONFIGURATION_BEAN_NAME) ObjectProvider<ClientConfiguration> globalClientConfiguration, | ||
@Qualifier("snsClientConfiguration") ObjectProvider<ClientConfiguration> snsClientConfiguration) { | ||
this.awsCredentialsProvider = awsCredentialsProvider.getIfAvailable(); | ||
this.regionProvider = properties.getRegion() == null ? regionProvider.getIfAvailable() | ||
: new StaticRegionProvider(properties.getRegion()); | ||
this.clientConfiguration = snsClientConfiguration.getIfAvailable(globalClientConfiguration::getIfAvailable); | ||
} | ||
|
||
@ConditionalOnMissingAmazonClient(AmazonSNSAsync.class) | ||
/** | ||
* Based on {@link io.awspring.cloud.autoconfigure.sns.SnsAutoConfiguration#snsClient} | ||
*/ | ||
@ConditionalOnMissingBean | ||
@Bean | ||
public AmazonWebserviceClientFactoryBean<AmazonSNSAsyncClient> amazonSNS(SnsProperties properties) { | ||
AmazonWebserviceClientFactoryBean<AmazonSNSAsyncClient> clientFactoryBean = new AmazonWebserviceClientFactoryBean<>( | ||
AmazonSNSAsyncClient.class, this.awsCredentialsProvider, this.regionProvider, this.clientConfiguration); | ||
Optional.ofNullable(properties.getEndpoint()).ifPresent(clientFactoryBean::setCustomEndpoint); | ||
return clientFactoryBean; | ||
public SnsAsyncClient amazonSNS(SnsProperties properties, AwsClientBuilderConfigurer awsClientBuilderConfigurer, ObjectProvider<AwsClientCustomizer<SnsAsyncClientBuilder>> configurer) { | ||
return awsClientBuilderConfigurer.configure(SnsAsyncClient.builder(), properties, configurer.getIfAvailable()).build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
src/main/java/de/idealo/spring/stream/binder/sns/provisioning/SnsStreamProvisioner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.