-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一个应用只允许一个gid,但是有好几个消费类(不同业务不同的topic),导致订阅关系不一致 #653
Comments
最简单的解决方案,不要让gid和应用绑定,gid本身就是一个消费组集群的概念,和应用不应该绑定。 The simplest solution is not to bind the gid with the application, as the gid itself represents the concept of a consumer group cluster and should not be tied to the application. |
在rocketmq中,可以通过consumer多次调用subscribe,使得一个consumer能够同时订阅多个topic;阅读了一下rocketmq-spring的代码,org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer,看起来是不支持这种做法的。 In RocketMQ, a consumer can subscribe to multiple topics by calling the subscribe method multiple times, allowing a single consumer to simultaneously subscribe to multiple topics. After reviewing the code of rocketmq-spring, specifically org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer, it appears that this approach is not supported. |
最后使用RocketMQPushConsumerLifecycleListener实现,写在了一个消费类里,多次subscribe,gid一个应用一个是公司限制,不允许自己创建。 |
可以将你的代码示例贴出来吗,这样别人碰到相同的问题看到你的issue也就可以解决了; Can you post your code example? This way, others facing the same problem can find a solution when they see your issue. Additionally, it is indeed not advisable to bind a group one-to-one with an application; it can be a many-to-one relationship. From best practices, it is recommended to create a new group when changing subscription relationships to enable the new subscriptions. |
如题,有没有好的解决方案?
@RocketMQMessageListener(
topic = "topic1",
consumerGroup = "spring-application-name",
messageModel = MessageModel.CLUSTERING
)
public class A{
}
@RocketMQMessageListener(
topic = "topic2",
consumerGroup = "spring-application-name",
messageModel = MessageModel.CLUSTERING
)
public class B{
}
难道要用一个类去监听所有的topic,然后再通过topic判断分别再去调用其他的类?
The text was updated successfully, but these errors were encountered: