TomCat 上没有配置任务执行器的 DirectMessageListenerContainer?

DirectMessageListenerContainer without a configured Task Executor on TomCat?

我正在为我的消息传递应用程序设置一个 DirectMessageListenerContainer。我正在使用 Tomcat、Spring、AMQP。

文档有这个警告https://docs.spring.io/spring-amqp/reference/#threading

With the DirectMessageListenerContainer, you need to ensure that the connection factory is configured with a task executor that had sufficient threads to support your desired concurrency across all listener containers that use that factory. The default pool size is only five.

在我的应用程序中,我没有配置任何执行器,所以我使用默认值。我没有这样做的原因是因为我在 tomcat 上操作,它设置了 10000 个最大线程。我最终会遇到池大小为 5 的瓶颈吗?

监听线程与tomcat线程无关。我刚刚查看了最新的 amqp-client(Spring AMQP 使用的 RabbitMQ java 客户端),现在的默认线程数是...

DEFAULT_NUM_THREADS = Runtime.getRuntime().availableProcessors() * 2;

这是否足以满足您的应用程序完全取决于您的应用程序、处理一条消息需要多长时间以及您配置的并发度(consumersPerQueue)。