freedom0123 commented on issue #748:
URL: 
https://github.com/apache/rocketmq-spring/issues/748#issuecomment-3607162471

   我看到了源码的这里:
   <img width="1153" height="581" alt="Image" 
src="https://github.com/user-attachments/assets/62df26ad-516e-4f5b-ae0a-0a1bbb2e2ec3";
 />
   
   ```java
   @Component
   @RocketMQMessageListener(topic = "coding-filter-message", consumerGroup = 
"coding")
   @Slf4j
   public class CodingFilterMessageRocketMqListener implements 
RocketMQListener, RocketMQPushConsumerLifecycleListener {
   
       @Override
       public ConsumeResult consume(MessageView messageView) {
           ByteBuffer body = messageView.getBody();
           String message = StandardCharsets.UTF_8.decode(body).toString();
           log.info("consume message: {}", message);
           return ConsumeResult.SUCCESS;
       }
       @Override
       public void prepareStart(PushConsumerBuilder consumerBuilder) {
           consumerBuilder.setConsumptionThreadCount(16);
       }
   }
   ```
   对于每个 Topic 
消费者,可以自行设置线程数,当然这个线程数是核心线程数,也是最大线程数.。下面是构建的线程池,构建的阻塞队列是无界的,也就是你这里配置的最大线程数实际上也不会生效
   ```java
   this.consumptionExecutor = new ThreadPoolExecutor(
               consumptionThreadCount,
               consumptionThreadCount,
               60,
               TimeUnit.SECONDS,
               new LinkedBlockingQueue<>(),
               new ThreadFactoryImpl("MessageConsumption", 
this.getClientId().getIndex()));
   ```
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to