use of com.amazon.sqs.javamessaging.ProviderConfiguration 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.ProviderConfiguration in project java-dynamic-sqs-listener by JaidenAshmore.
the class SqsListenersConfiguration method providerConfiguration.
// JMS Beans
/**
* Set up for JMS to set the number of messages to prefetch.
*
* @return the configuration for JMS
*/
@Bean
public ProviderConfiguration providerConfiguration() {
final ProviderConfiguration providerConfiguration = new ProviderConfiguration();
// This setting sets how many messages a thread can prefetch to place in it's own queue for processing.
// Note that this means that if the JmsListener is set to have concurrency 5 and therefore 5 threads are
// all processing messages than the total number of messages that would be in the queue are
// 5 * numberOfMessagesToPrefetch
providerConfiguration.setNumberOfMessagesToPrefetch(5);
return providerConfiguration;
}
Aggregations