2

How would I configure Spring Cloud AWS XML config with annotations?

I am especially interested in changing default taskExecutor.

luboskrnac
  • 23,973
  • 10
  • 81
  • 92

1 Answers1

3

I found that there is SimpleMessageListenerContainerFactory used to configure for AWS messaging via Java . So changing default taskExecutor is just matter for overriding this default container factory bean. Something like this:

@Bean
public SimpleMessageListenerContainerFactory simpleMessageListenerContainerFactory(AmazonSQSAsync amazonSqs) {
    SimpleMessageListenerContainerFactory factory = new SimpleMessageListenerContainerFactory();
    factory.setAmazonSqs(amazonSqs);
    Executor executor = Executors.newFixedThreadPool(1);
    ConcurrentTaskExecutor taskExecutor = new ConcurrentTaskExecutor(executor);
    factory.setTaskExecutor(taskExecutor);
    return factory;
}
luboskrnac
  • 23,973
  • 10
  • 81
  • 92