/** * Construct an asynchronous implementation of AmazonSQSAsync using the current builder configuration. * * @param params * Current builder configuration represented as a parameter object. * @return Fully configured implementation of AmazonSQSAsync. */ @Override protected AmazonSQSAsync build(AwsAsyncClientParams params) { return new AmazonSQSAsyncClient(params); }
/** * 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; }
/** * Construct an asynchronous implementation of AmazonSQSAsync using the current builder configuration. * * @param params * Current builder configuration represented as a parameter object. * @return Fully configured implementation of AmazonSQSAsync. */ @Override protected AmazonSQSAsync build(AwsAsyncClientParams params) { return new AmazonSQSAsyncClient(params); }
@Provides @Singleton public AmazonSQSAsync sqs(ApplicationProperties properties, AWSCredentialsProvider credentials, ExecutorService executor) { AmazonSQSAsyncClient sqs = new AmazonSQSAsyncClient(credentials, executor); sqs.setEndpoint(properties.lookup("aws.sqs.endpoint")); ShutdownHelper.addShutdownHook(sqs::getExecutorService, sqs::shutdown); return sqs; }
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); }
AmazonSQSClient client() { if (sqs != null) { return sqs; } sqs = new AmazonSQSAsyncClient(new BasicAWSCredentials(Config.AWS_ACCESSKEY, Config.AWS_SECRETKEY)); sqs.setRegion(Region.getRegion(Regions.fromName(Config.AWS_REGION))); sqs.setEndpoint(this.endpoint); Para.addDestroyListener(new Para.DestroyListener() { public void onDestroy() { sqs.shutdown(); } }); return sqs; }
public AmazonAwsSQSConnector(String awsAccessKey, String awsSecretKey, boolean isSecure, long receiveCheckIntervalMs, boolean isAsync) { super(receiveCheckIntervalMs, isAsync); AWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey); ClientConfiguration clientConfiguration = new ClientConfiguration(); String proxyHost = System.getProperty("http.proxyHost"); String proxyPort = System.getProperty("http.proxyPort"); if(proxyHost != null){ clientConfiguration.setProxyHost(proxyHost); if(proxyPort != null){ clientConfiguration.setProxyPort(Integer.parseInt(proxyPort)); } } clientConfiguration.setProtocol(isSecure ? Protocol.HTTPS : Protocol.HTTP); if (isAsync) { ExecutorService executorService = Executors.newSingleThreadExecutor(); _amazonSQS = new AmazonSQSAsyncClient(awsCredentials, clientConfiguration, executorService); _amazonSNS = new AmazonSNSAsyncClient(awsCredentials, clientConfiguration, executorService); } else { _amazonSQS = new AmazonSQSClient(awsCredentials, clientConfiguration); _amazonSNS = new AmazonSNSClient(awsCredentials, clientConfiguration); } }
credentialsProvider = new DefaultAWSCredentialsProviderChain(); c.client = new AmazonSQSAsyncClient(credentialsProvider);
protected AmazonSQSAsyncClient initSqs() { AWSCredentialsProvider credentials = new AWSCredentialsProviderChain( new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(), new StaticCredentialsProvider(new AppenderCredentials()), new ProfileCredentialsProvider(), new InstanceProfileCredentialsProvider() ); AmazonSQSAsyncClient sqs = new AmazonSQSAsyncClient(credentials, Executors.newFixedThreadPool(getThreads())); sqs.setEndpoint(getEndpoint()); return sqs; }