如何使用注释配置Spring Cloud AWS XML配置?
我对更改默认的taskExecutor特别感兴趣。
答案 0 :(得分:0)
我发现有SimpleMessageListenerContainerFactory
用于通过Java配置AWS消息传递。
因此,更改默认taskExecutor
只是覆盖此默认容器工厂bean的问题。像这样:
@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;
}