Search in sources :

Example 1 with DynamicDestinationResolver

use of org.springframework.jms.support.destination.DynamicDestinationResolver 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;
}
Also used : DefaultJmsListenerContainerFactory(org.springframework.jms.config.DefaultJmsListenerContainerFactory) SQSConnectionFactory(com.amazon.sqs.javamessaging.SQSConnectionFactory) DynamicDestinationResolver(org.springframework.jms.support.destination.DynamicDestinationResolver) Bean(org.springframework.context.annotation.Bean)

Aggregations

SQSConnectionFactory (com.amazon.sqs.javamessaging.SQSConnectionFactory)1 Bean (org.springframework.context.annotation.Bean)1 DefaultJmsListenerContainerFactory (org.springframework.jms.config.DefaultJmsListenerContainerFactory)1 DynamicDestinationResolver (org.springframework.jms.support.destination.DynamicDestinationResolver)1