use of com.amazon.sqs.javamessaging.SQSConnectionFactory in project kylo by Teradata.
the class SqsConfig method connectionFactory.
@Bean
public SQSConnectionFactory connectionFactory() {
String regionName = env.getProperty("sqs.region.name");
SQSConnectionFactory factory = SQSConnectionFactory.builder().withRegionName(regionName).withEndpoint("sqs." + regionName + ".amazonaws.com").withAWSCredentialsProvider(new DefaultAWSCredentialsProviderChain()).build();
LOG.info("Setup Amazon SQS ConnectionFactory for " + regionName);
return factory;
}
use of com.amazon.sqs.javamessaging.SQSConnectionFactory 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;
}
use of com.amazon.sqs.javamessaging.SQSConnectionFactory in project java-dynamic-sqs-listener by JaidenAshmore.
the class SqsListenersConfiguration method jmsListenerContainerFactory.
/**
* Create factory for attaching to the SQS Queues.
*
* @param amazonSqs the sqs client
* @param providerConfiguration configuration for this provided
* @return the JMS container factory used
*/
@Bean
public JmsListenerContainerFactory<DefaultMessageListenerContainer> jmsListenerContainerFactory(final AmazonSQSAsync amazonSqs, final ProviderConfiguration providerConfiguration) {
final DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(new SQSConnectionFactory(providerConfiguration, amazonSqs));
factory.setDestinationResolver(new DynamicDestinationResolver());
// This sets the default concurrency for each listener but it can be overridden by your JmsListener
factory.setConcurrency("10");
factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
return factory;
}
Aggregations