tianliu94321 commented on issue #523:
URL:
https://github.com/apache/rocketmq-spring/issues/523#issuecomment-1439697940
是整合到服务里的,我说的在nacos下线是指,在nacos的管理后台里面有个按钮可以单独的把一个服务的某个实例下线,在这个时候,走网关进来的请求是调不到这个实例的,但是MQ的消息还是可以接收到的。
我之前的问题是把服务从nacos中下线准备重启的时候消息还是会进来,这个其实是因为我的服务没有开启springboot的安全停机配置。开启安全停机配置之后,又有了一个新问题,关机的时候,消息还在消费中的时候会被直接杀掉,我在网上搜说可以同时实现RocketMQPushConsumerLifecycleListener接口,通过设置停机等待时间来避免。不知道可不可以这么写。
` @Override
public void prepareStart(DefaultMQPushConsumer consumer) {
consumer.setAwaitTerminationMillisWhenShutdown(20000);
}`
--
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]