francisoliverlee commented on issue #523: URL: https://github.com/apache/rocketmq-spring/issues/523#issuecomment-1445669297
> 看了下代码, 执行 ```java consumer.setAwaitTerminationMillisWhenShutdown(20000); ``` 在shutdown consumer的最终生效,生效代码如下: https://github.com/apache/rocketmq/blob/39bb9386f10d5d8dfe81183c172a3a86f6d313bd/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java#L712-L717 具体实现是平稳关闭消费线程池: https://github.com/apache/rocketmq/blob/39bb9386f10d5d8dfe81183c172a3a86f6d313bd/common/src/main/java/org/apache/rocketmq/common/utils/ThreadUtils.java#L147-L165 这种方式你可以试试, 但是需要注意如果消息消费时间很长的时候,可能有消息在等待关闭的时间内没有处理完,可能会重复投递,这种需要做消费幂等喔,话说回来了, 幂等都是需要做的。 -- 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]
