com.amazonaws.services.sqs.AmazonSQSAsyncClient Java Examples
The following examples show how to use
com.amazonaws.services.sqs.AmazonSQSAsyncClient.
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: SqsConfigurationTest.java From spring-cloud-aws with Apache License 2.0 | 6 votes |
@Test void configuration_withoutAwsCredentials_shouldCreateAClientWithDefaultCredentialsProvider() throws Exception { // Arrange & Act AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext( ConfigurationWithMissingAwsCredentials.class); // Assert AmazonSQSBufferedAsyncClient bufferedAmazonSqsClient = applicationContext .getBean(AmazonSQSBufferedAsyncClient.class); AmazonSQSAsyncClient amazonSqsClient = (AmazonSQSAsyncClient) ReflectionTestUtils .getField(bufferedAmazonSqsClient, "realSQS"); assertThat(DefaultAWSCredentialsProviderChain.class.isInstance( ReflectionTestUtils.getField(amazonSqsClient, "awsCredentialsProvider"))) .isTrue(); }
Example #2
Source File: SqsClientConfiguration.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Lazy @Bean(destroyMethod = "shutdown") public AmazonSQSBufferedAsyncClient amazonSQS() throws Exception { AmazonWebserviceClientFactoryBean<AmazonSQSAsyncClient> clientFactoryBean = new AmazonWebserviceClientFactoryBean<>( AmazonSQSAsyncClient.class, this.awsCredentialsProvider, this.regionProvider); clientFactoryBean.afterPropertiesSet(); return new AmazonSQSBufferedAsyncClient(clientFactoryBean.getObject()); }
Example #3
Source File: SqsConfigurationTest.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Test void configuration_withMinimalBeans_shouldStartSqsListenerContainer() throws Exception { // Arrange & Act AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext( MinimalConfiguration.class); SimpleMessageListenerContainer container = applicationContext .getBean(SimpleMessageListenerContainer.class); // Assert assertThat(container.isRunning()).isTrue(); QueueMessageHandler queueMessageHandler = applicationContext .getBean(QueueMessageHandler.class); assertThat(QueueMessageHandler.class.isInstance(queueMessageHandler)).isTrue(); HandlerMethodReturnValueHandler sendToReturnValueHandler = queueMessageHandler .getCustomReturnValueHandlers().get(0); QueueMessagingTemplate messagingTemplate = (QueueMessagingTemplate) ReflectionTestUtils .getField(sendToReturnValueHandler, "messageTemplate"); AmazonSQSBufferedAsyncClient amazonBufferedSqsClient = (AmazonSQSBufferedAsyncClient) ReflectionTestUtils .getField(messagingTemplate, "amazonSqs"); AmazonSQSAsyncClient amazonSqsClient = (AmazonSQSAsyncClient) ReflectionTestUtils .getField(amazonBufferedSqsClient, "realSQS"); assertThat( ReflectionTestUtils.getField(amazonSqsClient, "awsCredentialsProvider")) .isNotNull(); }
Example #4
Source File: SqsConfigurationTest.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Test void configuration_withRegionProvider_shouldUseItForClient() throws Exception { // Arrange & Act AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext( ConfigurationWithRegionProvider.class); AmazonSQSAsync bufferedAmazonSqsClient = applicationContext .getBean(AmazonSQSAsync.class); AmazonSQSAsyncClient amazonSqs = (AmazonSQSAsyncClient) ReflectionTestUtils .getField(bufferedAmazonSqsClient, "realSQS"); // Assert assertThat(ReflectionTestUtils.getField(amazonSqs, "endpoint").toString()) .isEqualTo("https://" + Region.getRegion(Regions.EU_WEST_1).getServiceEndpoint("sqs")); }
Example #5
Source File: BeanstalkConnector.java From cloudml with GNU Lesser General Public License v3.0 | 5 votes |
public BeanstalkConnector(String login, String pass, String region) { awsCredentials = new BasicAWSCredentials(login, pass); beanstalkClient = new AWSElasticBeanstalkClient(awsCredentials); this.beanstalkEndpoint = String.format("elasticbeanstalk.%s.amazonaws.com", region); beanstalkClient.setEndpoint(beanstalkEndpoint); this.rdsEndpoint = String.format("rds.%s.amazonaws.com", region); rdsClient = new AmazonRDSClient(awsCredentials); rdsClient.setEndpoint(rdsEndpoint); this.sqsEndpoint = String.format("sqs.%s.amazonaws.com", region); sqsClient=new AmazonSQSAsyncClient(awsCredentials); sqsClient.setEndpoint(this.sqsEndpoint); }
Example #6
Source File: SNSQueueManagerImpl.java From usergrid with Apache License 2.0 | 5 votes |
/** * Create the async sqs client */ private AmazonSQSAsyncClient createAsyncSQSClient( final Region region, final ExecutorService executor ) { final UsergridAwsCredentialsProvider ugProvider = new UsergridAwsCredentialsProvider(); final AmazonSQSAsyncClient sqs = new AmazonSQSAsyncClient( ugProvider.getCredentials(),clientConfiguration, executor ); sqs.setRegion( region ); return sqs; }