deanisty commented on issue #351: URL: https://github.com/apache/rocketmq-spring/issues/351#issuecomment-1185347933
> > > 如果代码中没有实现RocketMQMessageListener 的annotation,是不会创建RocketMQListenerContainer的。 > > > > > > 我现在是同一个项目同一套代码部署在两个集群,一个集群服务客户端http请求,一个集群专门处理后台脚本包括消息队列的消费者, 第一个集群我是不希望消费者启动过的,但是我找不到方法在第一个集群关掉consumer的 listener > > 这个解决了吗?我现在也遇到了这样的问题。springboot在启动时候回先去消费,而不是启动成功后再去消费。如果有大量的堆积mq,启动时候发现会特别慢。就是因为mq堆积导致在启动过程中先去消费造成的。 我自己写了AOP并配合配置中心的配置,在不需要消费者的项目里统一把消费者取消注入了。 具体就是AOP切面切入 ListenerContainerConfiguration.afterSingletonsInstantiated() 方法,然后around()方法不做任何操作直接返回void,以此达到不注入所有用RocketMQMessageListener注解的消费者实例,切面类本身用外部配置配合ConditionalOnProperty注解控制,可以实现用不同的配置打开或者关闭这个AOP的功能。 -- 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]
