use of com.amazon.sqs.javamessaging.SQSConnection in project kylo by Teradata.
the class SqsService method getQueue.
@Override
public Queue getQueue(String queueName) {
String name = destinationResolver.resolveName(queueName);
try {
// Create a new Queue if required
SQSConnection connection = connectionFactory.createConnection();
AmazonSQSMessagingClientWrapper client = connection.getWrappedAmazonSQSClient();
if (!client.queueExists(name)) {
client.createQueue(name);
}
// Queue must already exist
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
return session.createQueue(name);
} catch (JMSException e) {
throw new IllegalStateException(e);
}
}
use of com.amazon.sqs.javamessaging.SQSConnection in project goobi-workflow by intranda.
the class ExternalConnectionFactory method createSQSConnection.
private static Connection createSQSConnection(String username, String password) throws JMSException {
ConfigurationHelper config = ConfigurationHelper.getInstance();
AmazonSQS client;
if (config.isUseLocalSQS()) {
String endpoint = "http://localhost:9324";
String region = "elasticmq";
String accessKey = "x";
String secretKey = "x";
client = AmazonSQSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey))).withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region)).build();
} else {
client = AmazonSQSClientBuilder.defaultClient();
}
SQSConnectionFactory connectionFactory = new SQSConnectionFactory(new ProviderConfiguration(), client);
SQSConnection connection = connectionFactory.createConnection();
createQueues(connection);
return connection;
}
Aggregations