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);
}
}