use of com.amazonaws.services.sns.AmazonSNSAsyncClient in project metacat by Netflix.
the class SNSNotificationsConfig method amazonSNS.
/**
* If SNS notifications are desired and no existing client has been created elsewhere
* in the application create a default client here.
* @param config The system configuration abstraction to use
* @param registry registry for spectator
* @return The configured SNS client
*/
// TODO: See what spring-cloud-aws would provide automatically...
@Bean
@ConditionalOnMissingBean(AmazonSNSAsync.class)
public AmazonSNSAsync amazonSNS(final Config config, final Registry registry) {
final ExecutorService executor = Executors.newFixedThreadPool(config.getSnsClientThreadCount(), new ThreadFactoryBuilder().setNameFormat("metacat-sns-pool-%d").build());
RegistryUtil.registerThreadPool(registry, "metacat-sns-pool", (ThreadPoolExecutor) executor);
return new AmazonSNSAsyncClient(DefaultAWSCredentialsProviderChain.getInstance(), executor);
}
Aggregations