I'm setting a DirectMessageListenerContainer for my messaging application. I am working with Tomcat, Spring, AMQP.
The docs have this warning 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.
In my application, I haven't configured any executor so I am using the default. The reason I have not done so is because I am operating over tomcat which is set with 10000 max threads. Am I going to end up bottlenecked with a pool size of five?
The listener threads have nothing to do with tomcat threads. I just looked at the latest amqp-client (the RabbitMQ java client that Spring AMQP uses) and the default number of threads is now...
DEFAULT_NUM_THREADS = Runtime.getRuntime().availableProcessors() * 2;
Whether that is enough for your application entirely depends on your application, how long it takes to process a message, and how much concurrency you configure (consumersPerQueue
).