You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/11/28 03:49:28 UTC

[GitHub] [rocketmq-spring] shepherdviolet commented on issue #184: The config 'consumeThreadMax' is useless in annotation @RocketMQMessageListener

shepherdviolet commented on issue #184: The config 'consumeThreadMax' is useless in annotation @RocketMQMessageListener
URL: https://github.com/apache/rocketmq-spring/issues/184#issuecomment-559330672
 
 
   > This parameter is valid. The relevant code is below
   > https://github.com/apache/rocketmq-spring/blob/e5f28fec78f98b2ce877a4f4f4b1fbbcae248933/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/support/DefaultRocketMQListenerContainer.java#L208
   > 
   > 
   > https://github.com/apache/rocketmq-spring/blob/e5f28fec78f98b2ce877a4f4f4b1fbbcae248933/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/support/DefaultRocketMQListenerContainer.java#L468
   > 
   > Because this is the maximum number of threads in the thread pool, the maximum number of threads will not be reached when the concurrency is small.
   
   thank you for your reply! 
   For 'rocketmq-spring', this parameter is "valid".  However, after reading the source code of rocketmq-client, in class 'ConsumeMessageConcurrentlyService'
   
   ```text
           this.consumeRequestQueue = new LinkedBlockingQueue<Runnable>();
   
           this.consumeExecutor = new ThreadPoolExecutor(
               this.defaultMQPushConsumer.getConsumeThreadMin(),
               this.defaultMQPushConsumer.getConsumeThreadMax(),
               1000 * 60,
               TimeUnit.MILLISECONDS,
               this.consumeRequestQueue,
               new ThreadFactoryImpl("ConsumeMessageThread_"));
   ```
   
   You will find that the threads will only increase when the LinkedBlockingQueue is full, but the queue has no capacity set. So the thread never grows to its maximum. 
   ThreadPoolExecutor only increases threads to the maximum when using a SynchronousQueue queue or a LinkedBlockingQueue with limited capacity. 
   If we use RocketMQMessageListener to declare consumers, we have no way to increase the number of threads to more than 20. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services